|
|
Ok, I found a good javascript code snippet for toggleing an entry field.
<script type="text/javascript">
function toggle(){
var args=toggle.arguments, els=typeof args[0]=='object'? args[0].elements :
document.forms[args[0]].elements;
for (var i = els.length-1; i > -1; --i)
for (var j = args.length-2; j > 0; --j)
if(els[i].name==args[j])
els[i].disabled=args[args.length-1];
}
toggle.init=function(){
for (var f=document.forms, i = f.length-1; i > -1; --i)
for (var e=f[i].elements, j = e.length-1; j > -1; --j)
if(e[j].className&&/disabled/.test(e[j].className))
e[j].disabled=true;
};
</script>
</head>
<body>
<form name="test" action="#">
<div>
<input type="checkbox" onclick="toggle('test', 'bob', !this.checked);">
<input class="some disabled" type="text" name="bob">
</div>
</form>
<script type="text/javascript">
toggle.init();
</script>
While the code works great if I run it in a new .cfm page, when I enter it
into my main code, I get an error saying: "there is no method with the name
'toggle'"
I have to modify my code obvisly, and here is what I have so far:
<cfinput type="checkbox" name="enablehide" label="No Hire Date" onclick =
"toggle('HireDate', !this.checked);" />
Is there anyway to get the javascript function "toggle" to work with my CF
code? Also, I think the majority of my code is using Action Script (is this
similar to javascript?) for action operations.
Thanks again for any help!
Nick Butler
|
|