Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AJAX Values Sent to Modify Form but then Undefined on Update

    I have a common area called "leftbox" which I dump HTML code to. The Add works fine, however the Modify has a problem the response from my PHP call gets the correct record information and the form appears to be set up correctly. When I click on the Modify button, the call executes the PHP, however the values from the form are passed as undefined.

    var modify_firstname = "";
    var modify_lastname = "";

    // at this point the get_key, get_firstname, get_lastname values are confirmed to exist.
    document.getElementById('leftbox').innerHTML="<b>LEFTBOX(GET):<br></b>" +
    "<form id=\"harvester_form\">" +
    "Enter Harvestor Information and Click Modify" +
    "<br>First Name: <input type=\"text\" id=\"modify_firstname\" size=\"30\" value=\"" + get_firstname + "\"/><br>" +
    "<br>Last Name: <input type=\"text\" id=\"modify_lastname\" size=\"30\" value=\"" + get_lastname + "\"/><br>" +
    "<input type=\"button\" onclick=\"ajaxFunction('harvester_key=" + get_key + "&harvester_firstname=" + modify_firstname.value + "&harvester_lastname=" + modify_lastname.value + "','harvest_modify_harvester.php');\" value=\"Modify\"/>" +
    "</form>";

  • #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Your inputs don't have names, has to have a name to get passed to the server. ID is not the same. Also if you enclose your string with single quotes you could save yourself a lot of escaping. You should also close your br tags (<br /> ) I wouldn't mention it, but you are doing right by your inputs so may as well keep it consitent.
    Last edited by Basscyst; 09-15-2007 at 12:59 AM.
    Helping to build a bigger box. - Adam Matthews


  •  

    Posting Permissions

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