function ajax_example_simplest($form, &$form_state) {
//This is my ajax trigger element
$form['element_trigger'] = array(
'#type' => 'select',
'#options' => array(
'one' => 'one',
'two' => 'two',
'three' => 'three',
),
'#ajax' => array(
'callback' => 'ajax_example_simplest_callback',
/** Q: Can I somehow declare more than one wrapper? **/
//Say for instance, something like:
'wrapper' => array('replace_div_1', 'replace_div_2'),
),
);
//replace_div_1
$form['element_to_be_replaced_1'] = array(
'#type' => 'textfield',
'#title' => t("My conditional field one"),
'#prefix' => '<div id="replace_div_1">',
'#suffix' => '</div>',
);
//... more form elements here
//replace_div_2
$form['element_to_be_replaced_2'] = array(
'#type' => 'textfield',
'#title' => t("My conditional field two"),
'#prefix' => '<div id="replace_div_2">',
'#suffix' => '</div>',
);
return $form;
}
function ajax_example_simplest_callback($form, $form_state) {
//... do my stuff here
//normally I would return only the form bit for replacing a single wrapper
//declared in the trigger element, like this:
return $form['element_to_be_replaced_blahblah'];
}
क्या यह संभव है कि कॉलबैक फ़ंक्शन में एक से अधिक फॉर्म बिट को एजेएएक्स फ्रेमवर्क पर लौटाया जाए जो कि $form['element_to_be_replaced_1']
बदलना चाहिए <div id="replace_div_1">
और $form['element_to_be_replaced_2']
बदलना चाहिए <div id="replace_div_2">
?