I am trying to save an image using the following code.
function mymodule_user_page_form() { $form = array(); $form['submit'] = array( '#type' => 'submit', '#value' => 'Save', '#attributes' => array( 'id' => 'myid_save', ), '#submit' => array('mymodule_save'), ); return $form; } function mymodule_save($form, &$form_state) { $save = db_update('student',array('target' => 'import')) ->fields(array('id_status' => '1')) ->condition('stud-id', '101-03043', '=') ->execute(); if ($save) { drupal_set_message("Successfully saved."); } }
The JavaScript file contains the following code.
$('#myid_save').on('click', function(e) { myid_save_signature(); myid_save_photo(); });
In my case, the JavaScript functions aren’t called; the page refreshes before they are executed. I want to run those functions before mymodule_save()
is called.
How can I achieve this?
Sponsored by SupremePR