function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rakesh ERakesh E 

what is the difference between <apex:commandbutton> and <ape:commandlink>

hi ,

 

 

can anyone please explain me what is the difference between the <apex:commandbutton> and <apex:commandlink> in terms of its execution,rather than what HTML components they generate when used.

 

my understanding in terms of the HTML elements that are generated

 

<apex:commanbutton> : input element of type "submit"

<apex:commandlink> :  an <a> tag with autogenerated JS which handles "submit"

 

please let me know other diffenreces

 

Regards,

Rakesh

wt35wt35

There is no difference in terms of execution, as they are both driven by the "action" tag.

Thi tag refers to an Apex controller, so the whole execution is controlled by the APex controller, not the tag itself.

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_commandButton.htm

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_commandLink.htm

 

For both: "The button/link executes an action defined by a controller, and then either refreshes the current page, or navigates to a different page based on the PageReference variable that is returned by the action."