<label> <input type="radio" name="radio" id="yes" value="yes" />Yes</label> /> <label>
6 replies to this topic
#1
Posted 29 April 2011 - 03:34 PM
HOW CAN I SET A RADIO BUTTON TO REQUIRE AN ACCOUNT NUMBER IF YES IS SELECTED.
|
|
|
#2
Posted 29 April 2011 - 04:03 PM
Do you mean that if yes is selected, the user need to add an account number in a textbox?
by the way, your HTML is broken by the last /> on second row.
by the way, your HTML is broken by the last /> on second row.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#3
Posted 29 April 2011 - 04:11 PM
yes Orjan that's what i mean. can you help on this?
thanks for the heads up on that, ithappened on the copy/paste
thanks for the heads up on that, ithappened on the copy/paste
Orjan said:
Do you mean that if yes is selected, the user need to add an account number in a textbox?
by the way, your HTML is broken by the last /> on second row.
by the way, your HTML is broken by the last /> on second row.
#4
Posted 29 April 2011 - 05:28 PM
You can use javascript to show another input field once the user clicks on yes.
#5
Posted 30 April 2011 - 06:05 AM
do you know where i can find that script? or can you post it here for me. thank you for your help
dmanjrod said:
You can use javascript to show another input field once the user clicks on yes.
#6
Posted 30 April 2011 - 07:42 AM
Something like this:
First, here's your CSS which will hide the field for entering a user id when it loads.
And finally, this is the script that will handle the showing and hiding of the field.
When yes is clicked, the javascript function toggleuid() is called with an argument of 'show' and when no is clicked it will call it with an argument of 'hide'. You might want to look into Jquery since it can be done much easier and with much better aesthetics.
First, here's your CSS which will hide the field for entering a user id when it loads.
<style type="text/css">
#uid {
display: none;
}
</style>
Then here's your form:<label><input type="radio" name="radio" id="yes" value="yes" onClick="toggleuid('show');"/>Yes</label>
<label><input type="radio" name="radio" id="no" value="no" onClick="toggleuid('hide');"/>No</label>
<br />
<label id="uid">User id <input type="text" name="uidfield" /></label>
And finally, this is the script that will handle the showing and hiding of the field.
<script type="text/javascript">
function toggleuid(a) {
if (a == "show") {
document.getElementById('uid').style.display = 'block';
}
else {
document.getElementById('uid').style.display = 'none';
}
}
</script>
When yes is clicked, the javascript function toggleuid() is called with an argument of 'show' and when no is clicked it will call it with an argument of 'hide'. You might want to look into Jquery since it can be done much easier and with much better aesthetics.
#7
Posted 02 May 2011 - 11:28 AM
super helpful you are. works like a charm. thank you very much.
email
dmanjrod said:
Something like this:
First, here's your CSS which will hide the field for entering a user id when it loads.
And finally, this is the script that will handle the showing and hiding of the field.
When yes is clicked, the javascript function toggleuid() is called with an argument of 'show' and when no is clicked it will call it with an argument of 'hide'. You might want to look into Jquery since it can be done much easier and with much better aesthetics.
First, here's your CSS which will hide the field for entering a user id when it loads.
<style type="text/css">
#uid {
display: none;
}
</style>
Then here's your form:<label><input type="radio" name="radio" id="yes" value="yes" onClick="toggleuid('show');"/>Yes</label>
<label><input type="radio" name="radio" id="no" value="no" onClick="toggleuid('hide');"/>No</label>
<br />
<label id="uid">User id <input type="text" name="uidfield" /></label>
And finally, this is the script that will handle the showing and hiding of the field.
<script type="text/javascript">
function toggleuid(a) {
if (a == "show") {
document.getElementById('uid').style.display = 'block';
}
else {
document.getElementById('uid').style.display = 'none';
}
}
</script>
When yes is clicked, the javascript function toggleuid() is called with an argument of 'show' and when no is clicked it will call it with an argument of 'hide'. You might want to look into Jquery since it can be done much easier and with much better aesthetics.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









