I have an autocomplete field that selects id,text data from db table. I want to show the text in the field but need to put the selected id inside a hidden field so that, when the user submits the form, it is passed as form_values[] to _submit hook. Which is the correct way to do it in D7?

  • So you have a autocomplete field that when selected set an ID. You then want to put that ID in a hidden field? I seem to be missing something...
    – Steven
    Oct 21, 2013 at 16:17
  • Rather than hacking around with the javascript side of things in order to fill a hidden field, why not just do a lookup of the text value during form_validate() or form_submit()?
    – hargobind
    Nov 8, 2013 at 7:31

1 Answer 1


I've run into the same topics and found a solution, check it here: Autocomplete field - fill the selected id into another form element (eg. hidden field)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.