Jump to content

form value help


jmr3460

Recommended Posts

Hello all,

I do not do very much Javascript at all. I am basically trying to create a var and insert it either into a hidden form field or a input text field. I am working on a script that gets the GPS location of my Blackberry from my Blackberry. It will be a way for me to log in and out of jobs during the day. I have research the blackberry site and been able to develop a script that get my coordinates and send them to an alert window. This script works great. I have attempted to do this by changing the 'window.alert' to 'document.write' and make a var (I did not get something wright their or for some reason this did not work.  I think that this issue is that it takes several seconds to retrieve the coordinates).  I was hoping to be pointed to a way that I could insert those alert values into the form fields when I click the alert ok button or maybe when I click the ok button that creates the variables. Can anyone help me with this?

 

<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<script type="text/javascript">
<!--
function latlng(){
    	if(blackberry.location.GPSSupported){
    		document.write("Your device supports GPS lacating");
			blackberry.location.onLocationUpdate(window.alert("Latitude: " + blackberry.location.latitude +
			" Longitude: " + blackberry.location.longitude));
			blackberry.location.refreshLocation();
}
else{
document.write("Your device does not support GPS");
}
}
-->
</script>

    <head>
        <title>Blackberry GPS Logger</title>
    </head>
    <body onLoad="latlng()">

    </body>
</html>

 

This is what I have so far. Still researching.

 

Link to comment
https://forums.phpfreaks.com/topic/233233-form-value-help/
Share on other sites

I have now found a confirm box. Problem now is that when I click Ok nothing happens.

Here is the new code:

<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<script type="text/javascript">
<!--
function latlng(){
    	if(blackberry.location.GPSSupported){
    		document.write("Your device supports GPS lacating");
			var long = blackberry.location.onLocationUpdate(window.confirm("Latitude: " + blackberry.location.latitude + " Longitude: " + blackberry.location.longitude));
			blackberry.location.refreshLocation();
			if (long){
window.location = "http://www.abc.org"
}
else{
alert("Nothing happened")
}
}
else{
document.write("Your device does not support GPS");
}
}
-->
</script>

    <head>
        <title>GPS Testing</title>
    </head>
    <body onLoad="latlng();">

    </body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/233233-form-value-help/#findComment-1199495
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.