On my page I have an apex:inputhidden with a value linking to the APEX controller. It looks like this:

<apex:inputhidden value="{!conferenceId}" id="hiddenConference" />

Then I have an actionFunction that calls a method on the back end which will update that {!conferenceId} value. This is what the actionFunction looks like:

<apex:actionfunction name="passAttachmentToController"
                                 rerender="hiddenConference, errorMsgTop, errorMsgBottom" />

After the {!conferenceId} has been updated on the back end the actionFunction will reRender the inputHidden and it should get the new {!conferenceId} value. However the inputHidden would not get the new value.

I tried the same code replacing inputHidden with an outputpanel and it works. Here's the outputpanel:

<apex:outputpanel id="hiddenConference">{!conferenceId}</apex:outputpanel>

Any ideas why the outputpanel updates the {!conferenceId} value but the inputhidden would not?


I apologise. Actually the value of the inputHidden gets updated.

I was expecting that rerendering the inputHidden would update the value in javascript so that I would be able to retrieve the latest value with this line oncomplete:

theConferenceId = {!conferenceId};

Put the <apex:inputHidden> inside the <apex:outputPanel>, it should allow you to refresh and not lose the "Input" abilities.

<apex:outputpanel id="hiddenConferencePanel">
  <apex:inputhidden value="{!conferenceId}" id="hiddenConference" />

There might be other reasons for the problem you're experiencing (I'd like to see more code) but this will get you unstuck.

  • Is this an answer? – Adrian Larson May 27 '16 at 20:50
  • I guess it is. It should fix his problem. I'll rephrase. – Sebastian Kessel May 27 '16 at 20:55
  • It doesn't work. Just tried. – Arthlete May 27 '16 at 20:56
  • 2
    @Arthlete Make sure the rerender in your actionfunction is for the id of the outputpanel, not the inputhidden. – Thomas Taylor May 27 '16 at 21:01
  • 4
    Post your answer! Even if SFSE just ended up being your rubber duck it might help someone eventually. – Adrian Larson May 27 '16 at 21:21

I was wrong. The value of the inputHidden field had been updating all along. The issue arouse because I had a JavaScript variable linked to the same apex variable that the inputHidden was linking to. Like so:

Visual Force:

<apex:inputhidden value="{!conferenceId}" id="hiddenConference" />


var theConferenceId = {!conferenceId};

Thus I wrongfully assumed that by updating the inputField on the front end, the JavaScript variable theConferenceId would update its value as well(since it's all front end). However this is not the case.

Instead as a solution I linked the JavaScript variable to the inputHidden's value:

var theConferenceId = $("[id$='hiddenConference']").val();

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.