By drupaling.in on
Hi all, How to add onsubmit attribute to form. I need to run a js function and custom js validation function before submitting. How can I set the onsubmit attribute
Hi all, How to add onsubmit attribute to form. I need to run a js function and custom js validation function before submitting. How can I set the onsubmit attribute
Comments
found the answer
found the answer : $form['#attributes']['onsubmit'] = ' return func();';
$form['attributes']['onsubmit'] does not work for Drupal 6
I have tried using the solution above
$form['#attributes']['onsubmit'] = ' return func();';and unfortunately it does not work for Drupal 6.x
Do you know of a solution for Drupal 6?
put it in a module
You have to put it in your own custom module:
You can try this code. You
You can try this code. You can add other attributes which are separated by ','
I hope this will be useful to you.