Liferay Login Hook, error pop up

612 Views Asked by At

I need to show the errors in login hook of liferay in popup, but the sentence is only a line of code, so I don't know how implement the popup. the key line is the next:

<liferay-ui:error exception="<%= NoSuchUserException.class %>" message="This message is editable" />

This error is to showed in a label but I didn't need this.

like this example:: http://www.jose-aguilar.com/blog/wp-content/uploads/2012/07/bootstrap-modal.png

2

There are 2 best solutions below

0
Shivam Aggarwal On BEST ANSWER

In case you need to show errors in dialog box,I suppose you are using

SessionErrors.add(actionRequest, "error");

to send error from action phase.You can check SeesionErrors for 'error' attribute and display your message in dialog box:

       <% if(!SessionErrors.isEmpty(renderRequest))
    {
        String error=LanguageUtil.get(pageContext, "error");
        %>
    <aui:script>
  YUI().ready(function(A) {
    YUI().use('aui-base','liferay-util-window', function(A) {
        Liferay.Util.Window.getWindow({
            title : 'Error',
            dialog: {   
                bodyContent: '<%=error%>',
                destroyOnHide: true,
                cache: false,
                modal: true,
                height: 300,
                width: 300
                     }
                        })
                            });
                               });
    </aui:script>
    <%} %>
0
Miroslav Ligas On

Have look at the Alloy Documentation http://alloyui.com/examples/tooltip/

As Shivam suggested, you can use a scriplet to get the message.