Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

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 02-24-2009, 07:19 AM   PM User | #1
codingforumsun
New Coder

 
Join Date: Feb 2009
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
codingforumsun is an unknown quantity at this point
radio buttons not working properly

if( cols[5] != 'M' ) {
document.getElementById('Manager').checked=false;
document.getElementById('Trainer').checked=true;
alert("cols[5]: "+cols[5]);
}
else if( cols[5] != 'T' ) {
document.getElementById('Trainer').checked=false;
document.getElementById('Manager').checked=true;
alert("cols[5]: "+cols[5]);

In the above code I get 'M' and 'T' values from databse and the Manager radio Button works fine based on the value 'M'. But never Tariner Radio is checked even the value from database is 'T' and the alert shows it too.

Note: In the form I used attribute name="who" for both the Radio Buttons
Can any one help me? thanks
codingforumsun is offline   Reply With Quote
Old 02-24-2009, 07:33 AM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
In the above code I get 'M' and 'T' values from databse and the Manager radio Button works fine based on the value 'M'. But never Tariner Radio is checked even the value from database is 'T' and the alert shows it too.
How do you get the value from Database? Are you getting the right values?
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 02-24-2009, 01:39 PM   PM User | #3
codingforumsun
New Coder

 
Join Date: Feb 2009
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
codingforumsun is an unknown quantity at this point
Yes I get either 'M' OR 'T' depending on value in DataBase.
alert("cols[5[] : " cols[5[]); displays it. but somehow the document.getElementBYId('Trainer').checked=true; not working.

codingforumsun.


below is the some more code from webpage. I used name=Who for both the radio buttons.


<input type="radio" value=T name=Who id="Trainer">Trainer?<input type=radio value=M name=Who id="Manager">Manager?
codingforumsun is offline   Reply With Quote
Old 02-24-2009, 01:47 PM   PM User | #4
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
document.getElementById('Manager').checked=false;
document.getElementById('Trainer').checked=true;
I think you need to use the statement having checked=true, since both of them have the same name.
Code:
document.getElementById('Trainer').checked=true;
btw, properly enclose the attribute values inside double quotes, to make your markup valid.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 02-24-2009, 03:31 PM   PM User | #5
codingforumsun
New Coder

 
Join Date: Feb 2009
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
codingforumsun is an unknown quantity at this point
No luck I tried that.
codingforumsun is offline   Reply With Quote
Old 02-24-2009, 03:48 PM   PM User | #6
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
below is the some more code from webpage. I used name=Who for both the radio buttons.
<input type="radio" value=T name=Who id="Trainer">Trainer?<input type=radio value=M name=Who id="Manager">Manager?
Could you post your entire form and some more javascript, so that we can try to execute at our end?
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft 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 07:07 AM.


Advertisement
Log in to turn off these ads.