2

I've got a basic page, with a custom select (in order to show title text), wrapped in an apex:outputPanel. Whenever I try to change the input, its onchange fires, puts the right value into my selectedValue variable, and then sets the controller's record field.

However - the information on the page stays exactly the same. Its supposed to refresh and show some help text, but doesn't show anything different.

<apex:actionFunction action="{!SetValue}" reRender="fieldName" immediate="true" name="SetValue">
    <apex:param assignTo="{!SelectedValue}" id="fieldName" value="" name="SelectedSubstanceCode" />
</apex:actionFunction>


<apex:pageBlockSectionItem helpText="">
    <apex:outputLabel >Field</apex:outputLabel>
    <apex:outputPanel id="fieldName" >
        <!-- custom field --> 
    </apex:outputPanel>
</apex:pageBlockSectionItem>
2

See the id in the apex:param? id="fieldName"? Its the same id as the outputPanel - id="fieldName". Removing the id from the param causes the outputPanel to refresh.

My guess is that apex was trying to rerender the param due to the duplicate id. You aren't supposed to be able to re-use ids - if you try to put a duplicate id anywhere else it gives you an error - but not if you use it in your param.

This actionFunction works totally fine.

<apex:actionFunction action="{!SetValue}" reRender="fieldName" immediate="true" name="SetValue">
    <apex:param assignTo="{!SelectedValue}" value="" />
</apex:actionFunction>
  • Couldn't find anything about this error anywhere else. Lesson from this - don't give your param an id. – battery.cord Mar 26 at 13:10

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.