-->

reloading a certain jQuery code on jsf's form

2019-09-19 05:48发布

问题:

I have a jQuery code that makes a panel slide for the user to input data in

I have messages for errors that will be displayed in the panel in case of error occurance, the thing is when the user presses the submit button the panel disappears and inorder to see the error messages he has to press the display panel button again,

when the user presses the button again the panel appears with the errors in correctly but it has to be done by the user again.

I am trying to make the panel reappear automaticly when the error occurs, how could i do that ?

I am using JSF 2.0 and jQuery.

回答1:

If there ajax involved add this code to your js code

$(window).load(function() {

    jsf.ajax.addOnEvent(function (data) {
        if (data.status === "success") {
            //your code to show the panel with errors goes here
        }
    });

});