0

Is there a way I could not rerender a certain <apex:outputPanel /> when there is an error in a <apex:pageMessages />?

EDIT:

I tried, I use two actionFunction. the first one is to rerender the error for <apex:pageMessage />, the second actionFunction is to load the content from outputPanel if there where no error message.

  • the answer is yes but you need to show a bit more of what you've tried as there are many ways to do this, depending on context – cropredy Nov 10 '15 at 2:02
0

One way to do it is to use jQuery and a script to hide if messages are present:

<apex:pageMesages id="msgs"/>

<apex:outPutPanel layout="block" id="the_panel">
     ....your content here....


    <script>
       if($('[id$=msgs]').html() == '') $('[id$=the_panel]').hide();

    </script>
</apex:outPutPanel>

During an action simply serenader the_panel and the script will hide it if the msgs component has a message in it

Without knowing exactly what you are doing before, during, or after your code execution this is only an example of one possible way to do it. There may/will be better ways to do it depending on your page and apex code. This way has a downside of the panel possibly briefly being visible before it is hidden

0

Pages with StandardController has a property {!Messages}. You can use the to render <apex:outputPanel /> something like this.

<apex:outputPanel  rendered="{ISNULL(messages)}"/>`

OR

<apex:outputPanel  rendered="{!Messages.Empty}"/>`
  • if this is not a standard controller? – rpm07 Nov 10 '15 at 5:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.