Hello,

I have a form, displayed on a ctools modal wizard, which can get additional fields added to it via ajax. For example, there's a list of file inputs, and when the user clicks a button to add another file, a section of the form is rebuilt with the new input added.

Fields are added no problem. Printing $form shows that the fields are added as expected. However,
1) When submitting the form, only the original form fields are processed - none of the fields added via ajax
2) (related) When submitting a form that doesn't pass validation, the added-via-ajax fields aren't displayed when the form is rebuilt.

It looks like, although $form is successfully altered, $form_state doesn't have the new fields in $form_state['complete_form']. But it does have the values they contain in $form_state['input'].

Has anyone solved this before?

Comments

Larksmann’s picture

Status: Active » Closed (cannot reproduce)

I tried recreating this issue from its simplest constituent parts and couldn't - the issue must have lied in the complexity of the form, not ctools.