|
-
May 16th, 2001, 05:08 PM
#1
Thread Starter
Frenzied Member
Disabling Input Elements
I am not finding a way to do this, so it may not be possible, but...
I have two radio buttons and a series of text fields. If you radio A, it ignores the text fields, if you radio B, it uses the text fields. Ofcourse, "it" being the ASP that will parse the Request.Form() data.
My question is, is there a way that JavaScript can manually disable the text fields on radio A's click() event? Ofcourse, I would need to be able to enable them on radio B's event, but I imagine if one is possible, the other is, too. By disabling, I'm looking for some way to lock them, or grey them out, to keep the user from inputing anything into them.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
May 16th, 2001, 05:23 PM
#2
Fanatic Member
Maybe something like:
Code:
<script>
if (document.a.b.value != "") //null maybe?
document.a.b.value = "";
</script>
<form name="a">
<input type="text" name="b">
</form>
You can physically disable form elements by adding "disabled" to the list of attributes:
Code:
<textarea rows="5" disabled></textarea>
but this won't work in Netscape.
Last edited by Wynd; May 16th, 2001 at 05:30 PM.
Alcohol & calculus don't mix.
Never drink & derive.
-
May 16th, 2001, 06:39 PM
#3
Thread Starter
Frenzied Member
Yes, but I'm not sure if you can...
Code:
<html>
<head></head>
<body>
<form name='myForm'>
<input name='myInput'>
</form>
<script language='JavaScript'>
function DisableEm() {
document.forms[0].elements[0].disable = true;
}
</script>
</body>
</html>
Know what I mean? I haven't tried the above code because the Rhino book doesn't list disable as a method or property of the input element.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|