You need to sign in to do that
Don't have an account?

how to set parameter for actionfunction
I want to add some parameter for the function in actionfunction.
example:
visualforce code
<apex:actionFunction action="{!insertSelDMDocId}" status="selDocIdCb" name="insertSelDMDocId"/>
fuction abc(){
insertSelDMDocId();//i want to add a parameter like insertSelDMDocId(id)
}
apex code:
// I want to get id here like insertSelDMDocId(id) , but it some error occurred.
public void insertSelDMDocId() {
myid = id
}
i have no idea about this issue.
If anyone can help me?
Thank you very much!!
I think you can use param component here. Heres an example. (I have used actionSupport, but it can also be used with actionFunction)
<apex:actionSupport event="onclick" action="{!findDates}" reRender = "Dates ,TranscriptPanel">
<apex:param name="paramid" value="{!UserLists.UserId}"/>
</apex:actionSupport>
//////////// Heres the controller part
// Inside the function findDates()
String msgId = ApexPages.currentPage().getParameters().get('paramid')
All Answers
we use an input field for this
<apex:inputHidden value="{!myparameter}" id="mycoolID" />
somewhere on your page.
then in your javascript, you get the element and stuff a value into it.
here is an example of this technique
http://wiki.developerforce.com/index.php/Sites_And_Captcha
looks like this :
<apex:form > <apex:inputhidden value="{!challenge}" id="challenge" /> <apex:inputhidden value="{!response}" id="response" /> <script type="text/javascript"> function captureResponse(ele) { document.getElementById('{!$Component.challenge}').value = document.getElementById('recaptcha_challenge_field').value; document.getElementById('{!$Component.response}').value = document.getElementById('recaptcha_response_field').value; } </script>
now, in apex code your value is available for use
I think you can use param component here. Heres an example. (I have used actionSupport, but it can also be used with actionFunction)
<apex:actionSupport event="onclick" action="{!findDates}" reRender = "Dates ,TranscriptPanel">
<apex:param name="paramid" value="{!UserLists.UserId}"/>
</apex:actionSupport>
//////////// Heres the controller part
// Inside the function findDates()
String msgId = ApexPages.currentPage().getParameters().get('paramid')
Thank you all. I solved this problem.
Both of above solution are greate. I just did as you mentioned. It does work.