For a single value text field, I can just set the value of the hidden field. But for multi-value text field, drupal will only take the first value and omit following values even the browser post more than one value.
I insert some
input tag with same name (nearly, see below) under the form using jquery:
<input type="hidden" name="field_subscription_id[und][value]" value="52e1c1d99c29ec6fd84698b6" /> <input type="hidden" name="field_subscription_id[und][value]" value="52e1c1d99c29ec6fd84698b6" /> ...
data is POST like this (inspect using dev tool of chrome):
field_subscription_id[und][value]=52e1c1d99c29ec6fd84698b6 field_subscription_id[und][value]=52e3de349c29ec6fd84698d4 ...
After node created, the field
field_subscription_id will only have the first value.
So, any idea to make this work? ~thx
I define the form from UI, just a normal content type and a text field. I make a ajax request to external site from page, let user select something (from the ajax response), then fill a field of add-node form with the selected ids.
Using the AJAX response, I build a list of
<li> has a checkbox, the
form attribute (HTML5) of the checkbox has been set to the value of form-id of drupal add-node form on this page.