Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old February 11th, 2004, 09:31 AM
Desertsnowman Desertsnowman is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 10 Desertsnowman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Radio Buttons

hi - Ok - heres my problem.

Ive got a nonform modalDialog with radio buttons.

I want to get the value in a string with the selected radio button.

the code i tried just give out the first radio value and not the selected value.

please help !

Reply With Quote
  #2  
Old February 11th, 2004, 09:36 AM
Nicky's Avatar
Nicky Nicky is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Neverland
Posts: 606 Nicky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 3 m 26 sec
Reputation Power: 2
RE: Radio Buttons

Why a nonform?

Could you post your code please.

Reply With Quote
  #3  
Old February 11th, 2004, 09:48 AM
Desertsnowman Desertsnowman is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 10 Desertsnowman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Radio Buttons

Code:
function GetSelected(){

radioSel = document.getElementById('Align').value;
alert(radioSel);

}

    <input id="Align" type="radio" value="left" onClick="GetSelected()"> 
    <input id="Align" type="radio" value="right" onClick="GetSelected()"> 
    <input id="Align" type="radio" value="center" onClick="GetSelected()"> 



I want the code to alert() the value of the radio selected without submitting.
is it even possable ?

Thanks

Reply With Quote
  #4  
Old February 11th, 2004, 09:53 AM
Nicky's Avatar
Nicky Nicky is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Neverland
Posts: 606 Nicky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 3 m 26 sec
Reputation Power: 2
RE: Radio Buttons

I don't know why it's not working. Not my area. But if you are using an OnClick - why don't you just pass in a value?

Reply With Quote
  #5  
Old February 11th, 2004, 09:58 AM
Nicky's Avatar
Nicky Nicky is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Neverland
Posts: 606 Nicky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 3 m 26 sec
Reputation Power: 2
RE: Radio Buttons

Try changing ID to be NAME - see if it helps

Reply With Quote
  #6  
Old February 11th, 2004, 10:02 AM
Desertsnowman Desertsnowman is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 10 Desertsnowman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Radio Buttons

i tried name - and id together. still no good.

the only option i can think of is using a array indexing, therefore
counting how many radio buttins i have and go through them until i find the checked = true..



Reply With Quote
  #7  
Old February 11th, 2004, 10:08 AM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: Radio Buttons

Well, it isnt working, because you have more than one element with the same name, hence, the first defined variable is the one it is displaying. Try this: change the id's to name's, and then put a unique id name in the tag. For instance, <input type="radio" name="Align" id="align1" value="left">

Then you're going to need to rewrite that function:
Code:
function GetSelected(id){

radioSel = document.getElementById(id).value;
alert(radioSel);


For your onClick's tag do this: (for example, my id is align1)

<input type="radio" name="Align" id="align1" onClick="GetSelected('align1')">

PS: you need to keep the name identifier so that it switches in between the three buttons.



Reply With Quote
  #8  
Old February 11th, 2004, 10:21 AM
Desertsnowman Desertsnowman is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 10 Desertsnowman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: RE: Radio Buttons


Quote:
Well, it isnt working, because you have more than one element with the same name, hence, ....



Your're a genuis - cant believe i overlooked that one :p

I used that very idea when making a docheck function ;

i feel so small !

thanks again for all your help !

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > Radio Buttons


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT