Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-14-2007, 10:07 PM   PM User | #1
jameslove
New to the CF scene

 
Join Date: Aug 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
jameslove is an unknown quantity at this point
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>";
jameslove is offline   Reply With Quote
Old 09-14-2007, 11:55 PM   PM User | #2
Basscyst
Smokes a Lot


 
Join Date: Jul 2003
Location: CA, USA
Posts: 1,594
Thanks: 5
Thanked 20 Times in 20 Posts
Basscyst is on a distinguished road
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.
__________________
Helping to build a bigger box. - Adam Matthews

Last edited by Basscyst; 09-15-2007 at 12:59 AM..
Basscyst is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:59 PM.


Advertisement
Log in to turn off these ads.