I have 2 radio buttons whose values I can access on page 2 using $form_state['input']['submitted']['nameoffield'] when the field is not conditionally hidden. When conditionally hidden however (and pre-filled) I can't access the value, presumably because the field is disabled. What is the best way to access a pre-filled civicrm value on the second page of the webform?
1 Answer
Unfortunately it's a limitation of the Webform module (not specific to Civi) that hidden fields cannot be accessed as tokens or from hooks. They might be available in the $_POST superglobal, but only immediately after submitting page 1 (e.g. not after returning to page 2 from page 3, or from a saved draft, or from reloading page 2 with validation errors). Since you are writing php code, consider using the CiviCRM API to fetch this info instead.
-
Thanks, I didn't see your answer in time, and ended up copying the disabled value to a hidden field. CiviCRM API would clearly have been a better way to go.– TenzCommented May 2, 2015 at 16:01