473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

document.getElementById(id).value Returns Blank

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">
<tr>
<td>Username</td>
<td>
<input name="user" type="text" id="user" /> </td>
<td><span id="user_span">&nbsp;</span></td>
</tr>
<tr></tr>
<tr>
<td>Password</td>
<td>
<input name="pass" type="text" id="pass" /> </td>
<td rowspan="2"><span id="pass_span">&nbsp;</span></td>
</tr>
<tr>
<td>Retype pass </td>
<td>
<input name="repass" type="text" id="repass" /> </td>
</tr>
<tr>
<td>Name</td>
<td>
<input name="name" type="text" id="name" /> </td>
<td><span id="name_span">&nbsp;</span></td>
</tr>
<tr>
<td>Valid email</td>
<td>
<input name="email" type="text" id="email" /> </td>
<td><span id="email_span">&nbsp;</span></td>
</tr>
<tr>
<td>Iamge Verfication </td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><img src="image.php" /></td>
<td>
<input name="image" type="text" id="image" /> </td>
<td><span id="image_span">&nbsp;</span></td>
</tr>
<tr>
<td colspan="3">
<input type="button" value="Register" id="button" onclick="send();"/> </td>
</tr>
</table>[/HTML]

Please help

Thanks Scott.
Nov 17 '07 #1
2 8010
Worked it out i had 2 fields name user and pass sorry
Nov 17 '07 #2
gits
5,390 Expert Mod 4TB
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

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

Similar topics

1
by: lawrence | last post by:
This PHP function prints out a bunch of Javascript (as you can see). This is all part of the open source weblog software of PDS (www.publicdomainsoftware.org). We had this javascript stuff...
4
by: Ghyslaine Crespe | last post by:
Hello, In my script, the line document.getElementById(id).style.background-position = "-200px -500px"; fails ! So, how can I change the background-position value ?
3
by: davidkarlsson74 | last post by:
Error: document.getElementById("folderMenu").cells has no properties File: http://www.volkswagen.se/tillbehor/js/foldermenu.js Rad: 49 The function activates different DIV:s, but doesn't seem to...
6
by: Michi | last post by:
Hallo, of course, this doesn't work: document.getElementById('ID').style.-moz-user-select = 'text'; - but i hope it shows my problem... Is it possible to set this css option by javascript and...
2
by: Katie | last post by:
Hi I have a function which uses the document.getElementById('id') to change attributes of form objects etc. Is there any way i can find out if the element is a checkbox, textbox, radio button...
2
by: vps | last post by:
Please help me get the value of a textarea field: --------------------- The script --------------------- <html> <head> <script type="text/javascript">
29
by: Nick | last post by:
I've seen a few frameworks use the following: function $(id) { return document.getElementById(id); } Then to use: $('something').innerHTML = 'blah'; I'm just trying to roll this out to my...
15
by: phub11 | last post by:
Could someone please explain why the following works in IE5, but not FF3? Thanks in advance! function meRelease(id){ endnum = document.getElementById(id).value; alert(endnum); }
1
by: rsingh1980 | last post by:
Hi, I've been struggling with the below piece of code. it works in ie, but not in firefox.. I had to pass a piped string that carries the parameters to another gateway.. one of these was to be a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.