By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,221 Members | 582 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,221 IT Pros & Developers. It's quick & easy.

Problem With Getting Form Value

P: 1
I am having trouble getting data from a text input field element.
the element is called amount_$counter with $counter being the row of the table.
when i have made an input to the text field and submitted the onClick passes the table row to the javascript function, i then concatinate a string to be the same as the id of the element i want the input from.

i use the script below to get the input but the error i get is document.formProducts.nums.value; is null or not an object;

but when i use document.formProducts.object_6.value;
in the alert i get what i have just inut into the field, so this tells me that "nums" is not correct but i can' for the life in me find the problem.

Please help!!!

<from name=f"ormProducts" method="get" action="">
<td><input type='text' name='amount_$counter' id='amount_$counter' value='' size='3' >
<input name="btn_checkout2" type="button" id="btn_checkout2" value="" onClick=" pop_amount(<? echo $counter ?>);>

function pop_amount(row){
var amt='amount_';
var nums=amt+row;
//alert("element variable row " + row + "amt " + amt + " nums " + nums + "")

var vn = document.getElementById('nums');
var eval=document.formProducts.nums.value;
//alert("element variable " + vn + " " + eval + " ")

Jul 31 '06 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,208
Looks like nums is not a name or id of any of the input fields... get what i mean
if you wanted to get the value of document.formProducts.amount_$counter.value
Aug 1 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.