I have a form with a few fields the user should fill out. The form also have two hidden fields for the users current position (lat, long). I have spent quite some time now trying to find a way to fill these fields.
How I want it to work is like this: When form is submitted (jQuery OR OnSubmit in form tag) a JavaScript function that asks the device for location should be run. The hidden fields is then filled with the result.
I have working code for doing this but I can't get it to be called by Drupal.
Is there any way to run a JavaScript function upon form submit in Drupal or should I find another way to do it.
Many thanks,