You need to sign in to do that
Don't have an account?
prady-cm
whole page getting refeshed on click of save button
I have a VF page with a save button. i also have a apex:message in a outputpanel
<apex:pageBlockButtons id="blockbuttons"> <apex:commandButton value="Save" onclick="performValidation()" id="saveid"/> <apex:commandButton value="Cancel" action="{!ok}" /> </apex:pageBlockButtons>
<apex:outputpanel id="mess"> <apex:pageMessages /> </apex:outputpanel> <apex:actionFunction name="save" action="{!Save}" rerender="mess"/> <script language="javascript" type="text/javascript"> function performValidation() { Do something save(); }
In my controller i am validating some values and throwing an apex messages
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Error'));
This message doesnt seem to be getting displayed. The whole page gets refreshed after the save method is called and probably the messages are displayed. Is there anything that can be done to refresh only the output panel and not the whole page.
You have a race condition going on here, as your commandbutton is posting the form back but so is the actionfunction. If you want your javascript to be responsible for the page postback, you need to make you return false after executing the javascript, which tells the browser to cancel the default form submission behaviou
Should be as simple as:
All Answers
You have a race condition going on here, as your commandbutton is posting the form back but so is the actionfunction. If you want your javascript to be responsible for the page postback, you need to make you return false after executing the javascript, which tells the browser to cancel the default form submission behaviou
Should be as simple as:
OMG!!!
Bob!!! you are GOD...
I burnt so many hours trying to find out what was causing it...
Thanks a ton
Thanks Bob..!! :smileyhappy: