Raj_100 Posted September 2, 2014 Share Posted September 2, 2014 Hi can any one help on this below issue: in javascript dropw down list sending a null value.i have 2 textfiled and one drop down list. when i enter username and passaword and drop down is good.but issue is when i submit the dropdown value is null for chrome and issue is working fine in IE.for this i can able to see in log file. i hope issue with "document.getElementById("stdid ").value=stdrole" Can anyone tell me solution for this. Thanks in a Advance Regards Raj Kumar R Link to comment Share on other sites More sharing options...
JamesB Posted September 2, 2014 Share Posted September 2, 2014 Can you show the code for your form? Link to comment Share on other sites More sharing options...
Raj_100 Posted September 2, 2014 Author Share Posted September 2, 2014 function validateLoginForm(){ var username = document.getElementById("firstname").value; var password = document.getElementById("password").value; var rolesList = document.getElementById("stdid"); var roleValue = rolesList.options[rolesList.selectedIndex].value; if((username == null ||username =='') || (password == null||password=='') || stdid =='EMPTY_ROLE'){ document.getElementById("password").value = ""; document.getElementById('nullValidation').innerHTML = '<font color="#FF0000" size="1">Please enter a valid User ID, Stdid& Password before login.</font>'; return false; }else{ document.getElementById("stdid").value = roleValue; alert(document.getElementById("stdid").value); return true; } } If i set alert(document.getElementById("stdid").value); msg . Alertbox populated but when i check in chrome alertbox ix not coming and Stdid value is setting null. Please suggestion on this issue Link to comment Share on other sites More sharing options...
JamesB Posted September 2, 2014 Share Posted September 2, 2014 Does alert(roleValue) work? Link to comment Share on other sites More sharing options...
Raj_100 Posted September 2, 2014 Author Share Posted September 2, 2014 No It's Not working in Chrome But it works in IE. Note: when i submit the stdid value it goes as null value. Please give suggestion on this issue Link to comment Share on other sites More sharing options...
JamesB Posted September 2, 2014 Share Posted September 2, 2014 What is this code suppose to do? stdid =='EMPTY_ROLE' You don't have a local variable called stdid. Also please post your relevant html code. Link to comment Share on other sites More sharing options...
srinivas g Posted September 7, 2014 Share Posted September 7, 2014 Hi Raj can u tell me exactly what u want i can send a code u want ... which is compatible for all major browsers...! Link to comment Share on other sites More sharing options...
Raj_100 Posted September 9, 2014 Author Share Posted September 9, 2014 Thanks srini now issue is got fixed and let me tell you another issue var t1 = document.getElementById(id); this t1 value giving null can you please explain to me what are the way we can getelement in js Thanks in a Advance Regards Raj Kumar R Link to comment Share on other sites More sharing options...
justsomeguy Posted September 9, 2014 Share Posted September 9, 2014 var t1 = document.getElementById(id); this t1 value giving nullThat means that an element does not exist with that ID. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now