1

Im building a visualforce page using apex:dynamicComponent tag and adding fields from apex controller.

Component.apex.inputfield  roofShadingPreset = new Component.Apex.inputfield(); 

roofShadingPreset.id = 'shadingPreset1';

roofShadingPreset.expressions.value = '{!roof'+string.valueOf(i)+'.Shading_Preset__c}';

Component.Apex.ActionSupport asu = new Component.Apex.ActionSupport (event='onchange');  

asu.expressions.action='{!changeShadingValues}';

roofShadingPreset.childComponents.add(asu);

I need to pass a parametre in the action support event to the changeShadingValues() method. How can i do this?

0

There are several ways you can call a function with parameter from VF to your custom controller. I prefer using the remoteAction, but you can achieve this by using get and set methods as well. A naive implementation would look something like this:

@remoteAction
public static String changeShadingValues(String myParameter) {
    return  myParameter;
}

<apex:actionFunction action="{!changeShadingValues}" name="theFunction">
    <apex:param name="theParameter" value="{!myParameter}" 
</apex:actionFunction>

I hope this makes sense.

| improve this answer | |
  • I am not using the regular apex: actionfunction tag. Pls see the code i posted. Its a dynamic apex implementation. Component.Apex.ActionSupport asu = new Component.Apex.ActionSupport (event='onchange'); asu.expressions.action='{!changeShadingValues}'; I need to pass a parameter to changeshadingvalues method in apex. – Ravi Maddali Mar 31 '16 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.