[thelist] JavaScript: detecting and undoing radio button change

Jeff Howden jeff at jeffhowden.com
Wed Apr 2 12:55:15 CST 2003


roger,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Roger Ly
>
>
> Try this:
>
> function clearText()
> {
> 	if (confirm('do you want to do this?'))
> 	{
> 		// perform the text field clearing here
> 		return true;
> 	}
> 	else
> 	{
> 		return false;
> 	}
> }
>
> <input type="radio" ... onclick="return clearText();"/>
>
> returning false in the onclick handler suppresses the
> radio button from being selected.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

sure, it keeps the clicked radio button from being checked if the cancel
button is clicked.  however, it doesn't recheck the originally checked radio
button.  to do that you'd have to figure out which one was checked and
recheck it.

.jeff

http://evolt.org/

NOTICE:  members.evolt.org web and email address are changing!
---------------------------------------------------------------------
| OLD:                            | NEW:                            |
| jeff at members.evolt.org          | evolt at jeffhowden.com            |
| http://members.evolt.org/jeff/  | http://evolt.jeffhowden.com/    |
---------------------------------------------------------------------





More information about the thelist mailing list