You need to sign in to do that
Don't have an account?
Andrasko
commandbutton don't work after i use javascript
Hy everyone,
I have a vf page with a form. The form consists of input fields and two select. I use javascript to change the two select itmes. After I insert the javascript code to my page, the command button go wrong. If I clicks on the button the page reloaded.
Here is my simplified page:
<apex:page ..." > <script type="text/javascript"> function moveOptions(sourceID, destID) { ... </script> <apex:form id="id_01" > <table class="dfTable"> <tr class="odd"> <td class="column1">Name*:</td> <td> <apex:inputText value="{!name}"/> </td> </tr> <tr class="odd"> <td class="column1"> <apex:selectList id="actUser" ... > ... </apex:selectList> </td> <td> <a href="#" id="add" onClick="moveOptions(...)')" >>></a> </td> <td> <apex:selectList id="availableUser" ... > ... </apex:selectList> </td> </tr> </table> <apex:commandButton action="{!cancel}" title="Cancel" value="Cancel" /> <apex:commandButton action="{!save}" title="Save" value="Save" /> </apex:form>
Is anyone know why happening this? I spent a lot of time to solve it, but I haven't got any answer or solution.
If you don't want your VF page to refresh when you click a button, try adding this to your buttons: onComplete="return false;"
That *should* stop your page from refreshing.
i.e.
My problem is not the relodaing.
If I clicks on the command button, nothing happen.
Before I inserted the javascript code, the button call the controller save or cancel method.
Do you have any error in your javascript?
Sometime, JS error would malfunction a page.
If I don't call the javascript, everything is ok. ---> the button works well.
If I call the javascript the button go wrong.
Maybe something happens in the controller.