Révision b4adf10d
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/modules/simpletest/tests/ajax_forms_test.module | ||
---|---|---|
254 | 254 |
), |
255 | 255 |
); |
256 | 256 |
|
257 |
// Shows the Ajax 'add_css' command. |
|
258 |
$form['add_css_command_example'] = array( |
|
259 |
'#type' => 'submit', |
|
260 |
'#value' => t("AJAX 'add_css' command"), |
|
261 |
'#ajax' => array( |
|
262 |
'callback' => 'ajax_forms_test_advanced_commands_add_css_callback', |
|
263 |
), |
|
264 |
); |
|
265 |
|
|
257 | 266 |
$form['submit'] = array( |
258 | 267 |
'#type' => 'submit', |
259 | 268 |
'#value' => t('Submit'), |
... | ... | |
406 | 415 |
return array('#type' => 'ajax', '#commands' => $commands); |
407 | 416 |
} |
408 | 417 |
|
418 |
/** |
|
419 |
* Ajax callback for 'add_css'. |
|
420 |
*/ |
|
421 |
function ajax_forms_test_advanced_commands_add_css_callback($form, $form_state) { |
|
422 |
$commands = array(); |
|
423 |
$commands[] = ajax_command_add_css('my/file.css'); |
|
424 |
return array('#type' => 'ajax', '#commands' => $commands); |
|
425 |
} |
|
426 |
|
|
409 | 427 |
/** |
410 | 428 |
* This form and its related submit and callback functions demonstrate |
411 | 429 |
* not validating another form element when a single Ajax element is triggered. |
Formats disponibles : Unified diff
Udpate to 7.33