How To Get Radio Button Value In A Web Form
RegisterLogin
How To Get Radio Button Value In A Web Form
Post Description: javascript i will show you how to get radio button value in a web form if you are using javascript or an ajax web form, you might find yourself wondering how you can get the correct value of the radio buttons on your form. because when you submit the form
Tags: how, to, get, radio, button, value, in, a, web, form
This Post Was Posted On Aug 02, 2010 By Webune Support #3516
Post Description: javascript i will show you how to get radio button value in a web form if you are using javascript or an ajax web form, you might find yourself wondering how you can get the correct value of the radio buttons on your form. because when you submit the form
Tags: how, to, get, radio, button, value, in, a, web, form
This Post Was Posted On Aug 02, 2010 By Webune Support #3516
How To Get Radio Button Value In A Web Form by Webune Support
well, if you are in the same situation, you can write a javascript function to check whether the field is a button or not, and if it is a radio button type, you can get the value and send it to wherever you need to.
so i created this short script to show you how it works, you can create the script yourself, or you can downloaded it from this post. 1. first open your favorite text editor. i am using windows so i am going to be using notepad. open a blank notepad and copy and paste the following code:
<!--
############## CREATED BY WWW.WEBUNE.COM ###############
############## COPYRIGHT UGN/GPL 2010 #################
############# PLEASE DO NOT REMOVE THIS ###############
-->
<p>This small script shows you how to get the javascript value in a web form.<br /></p>
<script type="text/javascript">
<!--
function RadioButtonValue(){
for (var i=0; i < document.WebuneForm.color.length; i++){
if (document.WebuneForm.color[i].checked){
return document.WebuneForm.color[i].value;
}
}
}
function ShowValue(){
var RadioValue = RadioButtonValue();
alert('You Selected the Color: ' + RadioValue);
}
//-->
</script>
<form name="WebuneForm">
Whats your favorite color?<br>
<input type="radio" name="color" value="Red" checked="checked">Red<br>
<input type="radio" name="color" value="Blue">Blue<br>
<input type="radio" name="color" value="Yellow">Yellow<br>
<input type="radio" name="color" value="Black">Black<br>
<input type="radio" name="color" value="Green">Green<br>
<input type="button" onclick="ShowValue()" value="Check">
</form>
<p><img src="http://www.webune.com/images/headers/default_logo.jpg" /></p>
<p>Script Created by www.<a href="http://www.webune.com">Webune.com</a></p>
2. now save the file as radio-button.html - once you have save it, open it with your browser and see it in action.
DEMO:
Download File: radio-button.html
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
©2012 Webune Forums - Thu Dec 13, 2012 2:09 am
Powered by: Webune Forums V3
Powered by: Webune Forums V3