This topic is locked

Radio Buttons (Toggle)

8/25/2011 9:57:23 AM
ASPRunnerPro General questions
J
Jay123 author

Hi!
Do you have a code for toggling radio buttons using java script code on HTML editor? If I have 2 radio buttons (field1 and field2), I want those 2 radio button fields to toggle.
I was able to make it work on 2 checkboxes that behave like radio buttons but I couldn't find a code to apply that on radio buttons.
Thanks,

Jay

Sergey Kornilov admin 8/26/2011

You can use Javascript to make one of radio-button options selected.
A couple of examples that can help you get started:

http://www.somacon.com/p143.php

http://www.dynamicdrive.com/forums/showthread.php?t=33043

J
Jay123 author 8/31/2011

Hi!
I tested some codes but no luck.
I saw this code in the forum for dropdown box and it works.

=================================================================

<script>

document.forms.editform.value_country.onchange=function()

{

if(this.options[this.selectedIndex].value=='US')

document.forms.editform.value_state.disabled=false;

else

{

document.forms.editform.value_state.disabled=true;

document.forms.editform.value_state.value='';

}

}

</script>

=================================================================
If I am going to use radio buttons for both "country" and "state" instead of dropdown, could you pls. let me know how can I disable the "state" choices?
Thanks,

Jay

Sergey Kornilov admin 9/1/2011

Jay,
you can use Javascript API to disable or enable any control on Add/Edit pages.
More info:

http://xlinesoft.com/phprunner/docs/ctrl_setdisabled.htm

http://xlinesoft.com/phprunner/docs/ctrl_setenabled.htm