used by: button, checkbox, checkboxes, image button, password, radio, radios, select, submit, tableselect, textarea, text_format, textfield
Is there any neat way to do it?
Currently I'm writing something like this:
$ajax_code = array( 'callback' => 'poll_choice_js', 'wrapper' => 'poll-results', 'method' => 'replace', 'effect' => 'fade', );
And then in each element:
'#ajax' => $ajax_code,
But it will be easy to forget to add this line to some elements in future, so I'm looking for a way less prone to errors.
Reason: My wrapper is actually outside a form and is used for preview, I need to update preview every time anything changes. Form will never need to be submitted. Ajax will never change form elements.