You need to sign in to do that
Don't have an account?
dipu
How do I include a commandButton with no action no server call in a VF page.
I have a confirmation dialog with Ok and Cancel button. When user clicks OK I would call server action to proceed and on cancel no server call is necessary.
I want to use the apex:commandButton for both to make sure that they use the same css style. Even if I do not have the action parameter the command submits a call to the server.
I guess you can use the command buttons also like following :-
<apex:commandButton value="Cancel" onclick="return false;" />
by doing so it will not call anything at server side, in fact it will do nothing, give it a try.
All Answers
apex:commandButton is a controller invoker, so it will invoke the server. You could use an input field of type button (" <input type="button" class="btn" value="Label"/> "), or a button (" <Button style="btn">Label</Button> "), You can get faster response from an apex:commandButton by using "immediate="true"", which bypasses normal validation and such.
I guess you can use the command buttons also like following :-
<apex:commandButton value="Cancel" onclick="return false;" />
by doing so it will not call anything at server side, in fact it will do nothing, give it a try.