This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes how to get the radio button value in the ajax script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to get the radio button value in the ajax script" Watch "how to get the radio button value in the ajax script" New topic
Author

how to get the radio button value in the ajax script

saipraneeth nallapareddy
Ranch Hand

Joined: Dec 02, 2009
Posts: 159
i am submitting a form using the Ajax script earlier it did not contain any radio button, but now in order to refine the search based on the form submitted values now i am adding two radio buttons.

Now the problem is when i try to append the radio button value in the same way as i did for my other form objects(document.formName.elementIdName.value), i found that it did not received the value and states it as undefined , i have rectified this by replacing the earlier way with document.getElementById('XXX').value.

the problem i am facing with the above approach is, it is taking the radio button the one which is coming first in the html code not the one i clicked.

can any one help me in this regard, thanks in advance.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

saipraneeth nallapareddy wrote:Now the problem is when i try to append the radio button value in the same way as i did for my other form objects(document.formName.elementIdName.value), i found that it did not received the value and states it as undefined ,

Use the same approach. "elementIdName" must be the name of the input tag and before taking its value, check whether its checked or not. And you can find plenty of example of how to do so.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
saipraneeth nallapareddy
Ranch Hand

Joined: Dec 02, 2009
Posts: 159
i have even tried that & found the value passed as undefined
saipraneeth nallapareddy
Ranch Hand

Joined: Dec 02, 2009
Posts: 159
ok members i have rectified it by checking the checked status and passing my desired values in the script working fine now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get the radio button value in the ajax script
 
Similar Threads
radio button select state
Ajax Problem
struts and ajax
passing hidden values
want to get the value of selected radio button