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

document.getElementById(id).value Returns Blank

P: 11
I have this script to validate my reregistration form then send it to a AJAX handler to create the new user my problem is that when getting the value of the username and password filed it returns blank not "undefined" but just "" but it returns the rest of my form fine.
my JavaScript is:
Expand|Select|Wrap|Line Numbers
  1. function send(){
  2.     var user = document.getElementById('user').value;
  3.     alert(document.getElementById('user').value);
  4.     var pass = document.getElementById('pass').value;
  5.     var repass = document.getElementById('repass').value;
  6.     var name = document.getElementById('name').value;
  7.     var email = document.getElementById('email').value;
  8.     var image = document.getElementById('image').value;
  9.     alert(user+'\n'+pass+'\n'+repass+'\n'+name+'\n'+email+'\n'+image);
  10.     //xajax_sendreg(user,pass,repass,name,email,image);
  11. }
and my html is
[HTML]<table width="*" border="0" class="a">
<input name="user" type="text" id="user" /> </td>
<td><span id="user_span">&nbsp;</span></td>
<input name="pass" type="text" id="pass" /> </td>
<td rowspan="2"><span id="pass_span">&nbsp;</span></td>
<td>Retype pass </td>
<input name="repass" type="text" id="repass" /> </td>
<input name="name" type="text" id="name" /> </td>
<td><span id="name_span">&nbsp;</span></td>
<td>Valid email</td>
<input name="email" type="text" id="email" /> </td>
<td><span id="email_span">&nbsp;</span></td>
<td>Iamge Verfication </td>
<td><img src="image.php" /></td>
<input name="image" type="text" id="image" /> </td>
<td><span id="image_span">&nbsp;</span></td>
<td colspan="3">
<input type="button" value="Register" id="button" onclick="send();"/> </td>

Please help

Thanks Scott.
Nov 17 '07 #1
Share this Question
Share on Google+
2 Replies

P: 11
Worked it out i had 2 fields name user and pass sorry
Nov 17 '07 #2

Expert Mod 5K+
P: 5,390
hi ...

no problem ... glad to hear that you find it out for yourself :) post back to the forum anytime you have more questions ...

kind regards
Nov 18 '07 #3

Post your reply

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