I'm trying to use ajax to update two different parts of a drupal form from just one form input blur.
I have the standard ajax stuff on my input:
$my_form['my_input']['#ajax'] = array(
'callback' => 'my_callback',
'wrapper' => 'my_target_div',
'event' => 'blur',
);
This is working well, swapping out my div when the input is updated ... however I also want to update another form input elsewhere in the form with different code as a result of the blur on my original input.
Is this possible, any ideas?
Edit: For clarity, here's my real world example:
- Content type 'movie'
- Added field 'primary_title'
- When 'primary_title' is updated my ajax callback checks for similar strings and returns html.
The html from the callback is inserted into an empty div.
That part is working great!
I'm trying to also modify the standard node 'title' input, giving it the value of 'primary_title' after I have done some regex to tidy up the string (removing "The" or "A" from the start etc) The result will be two title fields, one with the complete title 'primary_title' and one trimmed 'title' that will be useful for sorting and displaying records.