I am struggeling with onsubmit and changing the values of hidden fields with JS before the form is sent.
some Code:

Sample HTML:
<form method="_GET" action="gps.php" id="form1" onsubmit="return submitForm1();">
<input type="hidden" name="foo" id="foo" value="0">
<div onclick="$('#form1').submit();">Submit the form</div>


function submitForm1() {
$('#foo').val('foo new value');
return true;

When I submit the form a message box appears and tells me "foo new values". On my server the corresponding GET-Value which is sent is still "0"

This ist just an example - in real world I am doing GEOCODING of an address or using geo.location for reading gps coords.

Any help is appreciated.