I’ve built a form with the form API, and it’s submitting via ajax via this type of thing:
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'submit',
'#ajax' => array(
'callback' => 'handyman_form_callback',
'method' => 'replace',
'wrapper' => 'form-wrap',
'effect' => 'fade'
)
);
The problem is, if the form is returned due to validation errors the javascript applied to the form no longer works. I’ve read lots about the attachBehaviors function but I’m not sure where I could put this to make it work, and not sure if this is even the correct thing to do.
Any help?