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
Mack DsozaMack Dsoza 

actionCommand & actionFunction

<apex:commandLink value="{!STList.RecordType}" action="{!showPopUp}" reRender="PopupPanel">                                  <apex:param name="RtId" value="{!STList.RecordTypeIdStr}" assignTo="{!AssetBeanObj.selRecordTypeId}" />                             <apex:param name="RtName" value="{!STList.RecordType}" assignTo="{!AssetBeanObj.selRecordTypeName}" />                      </apex:commandLink>

 

<apex:actionFunction name="showPopUpfun" action="{!showPopUp}"/> 

 

Here in code both the tags are written as <apex:commandLink> & <apex:actionFunction> so plz tell me that what it will do ?

& What happend when I write both the tags at the same time that means here is any concept of javascript or any other concept that needs to written.

tell me actual purpose of actionFunction & when should I use this tag ?

bob_buzzardbob_buzzard

actionfunction is used to make a method in the controller (an action method) available through javascript.  This means that you can call the action method directly from javascript.

 

The commandlink will execute the method in the controller when the user clicks on a link.

Mack DsozaMack Dsoza

<apex:repeat>

 

<apex:commandLink value="{!STList.RecordType}" action="{!showPopUp}" reRender="PopupPanel">                                        <apex:param name="RtId" value="{!STList.RecordTypeIdStr}" assignTo="{!AssetBeanObj.selRecordTypeId}" />                             <apex:param name="RtName" value="{!STList.RecordType}" assignTo="{!AssetBeanObj.selRecordTypeName}" />         </apex:commandLink>

 

<apex:actionFunction name="showPopUpfun" action="{!showPopUp}"/> 

 

</apex:repeat>

 

But please explain me what the above code is doing here ?

Why they have used same action method on both the tags...

 

bob_buzzardbob_buzzard

I'd assume because they want to be able to invoke the same method from two different places, either when the user clicks a command link or from inside some javascript code.

 

There's no reason why the same method cannot be accessed in a variety of different ways.  That said, the fact that its inside a repeat loop may well break the actionfunction as you'd end up with several functions with the same name.