Results 1 to 5 of 5

Thread: Value to next page

  1. #1
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default Value to next page

    How can I have javascript send it's value in a form

    I have this form:

    Code:
    <form method="post" action="submit.php">
    Name:<input type="text" name="name" /><br />
    City:<input type="text" name="city" id="city"/><br />
    State:<input type="text" name="state" id=state" /><br />
    Address:<input type="text" name="address" id="address" /><br />
    Phone:<input type="text"  name="phone" /><br />
    <input type="hidden" name="latlong" value="???" /><br />
    <input type="submit" onClick="javascript:submitdata();"  />
    </form>
    and I want the address, city, and state to go into the var address I then want the output of that which is point to be passed in the latlong value.

    This is my idea of how it might function but I'm not sure cause I don't know javascript. Hope someone here can help me out.

    Code:
    var address = "document.submitform.address.value + /", /" + document.submitform.city.value/" + /", /" + document.submitform.state.value";
     geocoder.getLocations(address, locate);	
       function locate(response)
       {
          place = response.Placemark[0];
          point = new GLatLng(place.Point.coordinates[1],
                              place.Point.coordinates[0]);
    This is what I expect address to equal with this address, city, state

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Okay got it to here. It alerts the address fine but doesn't bring up the 1.5 so there's something wrong around there. Any ideas?

    Code:
    	var address = document.submitform.address.value + " " + document.submitform.city.value + ", " + document.submitform.state.value;
    	alert(address);	
    	geocoder.getLocations(address, get_address);	 
    }
       // This function adds the point to the map
       function get_address(response)
       {
    	alert("1.5");
       // Retrieve the object
       place = response.Placemark[0];
       alert("2");

  3. #3
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    Is your second piece of code complete, if so then you have a "}" that is not opened. Have you enabled javascript debugging.

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    It was a piece of a chunk i didn't include the start of the function because the alerts at the beginning worked. I actually gave up on this but I don't know how to turn on debug or run traces how do you do that without using alerts?

    EDIT: Figured this half out. Also I might figure this out soon but so far google hasn't helped does anyone know how to read this? Is this setting Radius's value to 500 if something happens?

    oRadius.value = oRadius.value ? oRadius.value : 500;
    Last edited by bluewalrus; 09-25-2009 at 01:49 AM.

  5. #5
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    Depends on your browser, in IE look in Tools/Internet Options/Advanced and you'll see an option to disable javascript debugging, untick that ans save.

    In Firefox, there is an add-on for this but it is easier to use the error console.

    In Opera you can use the error console.

    This is an essential way to ensure that your javascript is error free, you get pointed to the problem lines

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •