I am looking to add a conditional checkbox to a CFINPUT
field. When the box is checked, I want it to either grey out, or
remove the cfinput field frm the screen. I am unfamiliar with how
checkboxes work, so could anyone provide some sample code for how
to go about this? Here is essentially how i want it to work:

<checkbox>

if unchecked,

make cfinput field visible and usable

if checked

get rid of the cfinput field

Thanks for any help.

Nick Butler

|||
google “javascript toggle enabled” and you should find some
code samples.|||
Ok, I found a good javascript code snippet for toggleing an
entry field.

<head>

<title></title>

<meta http-equiv=”Content-Type” content=”text/html;
charset=iso-8859-1″>

<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
.name==args[j])

els
.disabled=args[args.length-1];

}

toggle.init=function(){

for (var f=document.forms, i = f.length-1; i > -1; –i)

for (var e=f
.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
|||
You’re using flash forms? Try that google search again but
with actionscript instead of javascript.|||
Conditional checkbox is very useful in programs.

For music
http://mp3bravo.com

|||
I tried searchign for “actionscript toggle enabled” but could
not find anything. Can anyone help me out? Thanks.|||
Ok, I am taking another apporoach to this prob. Wrather than
making an actionscript function, I am trying to handle this with
CFIF. Escentially I want the HireDate input field to become usable
when I check the check box. When I run this however, I am getting a
“Variable ENABLEHIDE is undefined”. Could someone help me out?

<cfinput type=”checkbox” name=”enablehide” label=”No Hire
Date” value=”1″/>

<cfif enablehide NEQ 1>

<cfformgroup type=”horizontal” visible=”yes”
enabled=”yes” style=”marginLeft:-74;” >

<cfinput type=”datefield” name=”HireDate” label=”Hire
Date:” width=”91″ bind=”{contactList.selectedItem.HireDate}”
onchange=”UpdateSelect(HireDate);”/>

</cfformgroup>

</cfif>|||

quote:


Originally posted by:
NickoSwimmer


Ok, I am taking another apporoach to this prob. Wrather than
making an actionscript function, I am trying to handle this with
CFIF.


Slight problem. Cold Fusion runs on the server and you want
client side programming.

Related posts:

  1. cfif based on checkbox
  2. How to determine if a checkbox is checked in Flash forms
  3. changing the size of text input field in xml style coldfusion forms
  4. Checkbox issue
  5. input text field

Related posts brought to you by Yet Another Related Posts Plugin.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

   
© 2012 free icons download Suffusion theme by Sayontan Sinha

Featuring Recent Posts WordPress Widget development by YD