I'm trying to set up a function to pull terms from a referenced node and pre-fill the fields on a new node. I can get everything working right up to the point where I need to insert the collected values back in and I just can't figure out how to do it.
To explain my scenario better, I have a Node Reference field. When a user enters a value in there and presses the pre-fill button I created, a function fires to collect the terms that have been saved on the referenced node/s.
All the fields are Taxonomy terms and use the Autocomplete deluxe widget.
I tried using the default http://api.drupal.org/api/drupal/includes%21form.inc/function/form_set_v... but just couldn't get it to play. Should it work?
So how, from template.php or a custom module, do you programatically add new terms to autocomplete deluxe fields?
Comment | File | Size | Author |
---|---|---|---|
#3 | screenshot.png | 3.75 KB | fishfree |
#1 | setting values.png | 15.43 KB | LNakamura |
Comments
Comment #1
LNakamura CreditAttribution: LNakamura at Mediacurrent commentedHi, @marblegravy - have you figured this out yet? If not, and assuming you're currently using the 2.x branch of Autocomplete Deluxe (1.x is no longer supported), here's what I did in a
hook_form_alter()
to programmatically set the values in an Autocomplete Deluxe widget:Let us know - thanks!
Note: in my case, I was modifying a Views exposed filter, hence the "_tid" at the end of the field name...
Comment #2
fishfree CreditAttribution: fishfree commented@LNakamura Could you tell me how to do it in a form element ajax callback?
Comment #3
fishfree CreditAttribution: fishfree commentedMy screenshot: