I am having difficulties regarding the way to add onsubmit to some forms.
I have embedded forms in landings, called via
<?php $nid = 12; $wnode = node_load($nid); $form = drupal_get_form('webform_client_form_' . $nid, $wnode, array()); print render($form); ?>
I would like these forms to have an extra "onsubmit" attribute to call a function.
I've seen some examples of codes like this
$form['#attributes']['onsubmit'] = 'return myFunction();';
I do not want to put this code in the core of the module, to avoid conflicts with the landings in which the script called is not present.
What would be the right way to get this?
I hope to express myself clearly, thank you