• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get the radio button value in the ajax script

 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have even tried that & found the value passed as undefined
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok members i have rectified it by checking the checked status and passing my desired values in the script working fine now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic