dynamically set required attribute in cfform flash

View: New views
4 Messages — Rating Filter:   Alert me  

dynamically set required attribute in cfform flash

by Eileen Collins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a cfform flash in an application. I want to be able to set the required="yes" on a form field after a user checks the checkbox above it. SO for example, if the user checks the "I have my keys" box, then the "keydate" form field becomes required.

I've tried it the same way for the enable attribute, but I get error that required attribute is not boolean like the enable attribute.


<cfform action="" method="POST" name="myform" width="850" format="Flash" >

<cfinput type="Checkbox" name="haskeys"  label="I have my keys" visible="Yes" enabled="Yes">

<cfinput type="DateField" name="keydate" width="100" label="Date My keys were Provided" required="" size="20" visible="Yes"  value"">

<cfinput type="submit" value="Submit" name="submit">
</cfform>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: http://www.houseoffusion.com/groups/cf-flash/message.cfm/messageid:281
Subscription: http://www.houseoffusion.com/groups/cf-flash/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.30

Re: dynamically set required attribute in cfform flash

by Chris Velevitch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Read this article:-

http://www.asfusion.com/blog/entry/enabling-and-disabling-validation-in


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au

Adobe Platform Users Group, Sydney
January '09 meeting: Looking Ahead To The Next Version Of Flex Builder
Date: Mon 19th January 6pm for 6:30 start
Details and RSVP http://groups.adobe.com/posts/b3ccf0d972

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: http://www.houseoffusion.com/groups/cf-flash/message.cfm/messageid:282
Subscription: http://www.houseoffusion.com/groups/cf-flash/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.30

Re: dynamically set required attribute in cfform flash

by Eileen Collins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Chris, that article was helpful. I can use it with some tweaking. What I wanted was to set the field required only if the checkbox was checked. I tried the code on the article page and changed the required ="no" and then click 'enable' button, but nothing happened.

I'll just need to create an onsubmit function to determine if checkbox is checked and code to disabe if not checked

>Read this article:-
>
>http://www.asfusion.com/blog/entry/enabling-and-disabling-validation-in
>
>
>Chris
>--
>Chris Velevitch
>Manager - Adobe Platform Users Group, Sydney
>m: 0415 469 095
>www.apugs.org.au
>
>Adobe Platform Users Group, Sydney
>January '09 meeting: Looking Ahead To The Next Version Of Flex Builder
>Date: Mon 19th January 6pm for 6:30 start
>Details and RSVP http://groups.adobe.com/posts/b3ccf0d972 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: http://www.houseoffusion.com/groups/cf-flash/message.cfm/messageid:283
Subscription: http://www.houseoffusion.com/groups/cf-flash/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.30

Re: dynamically set required attribute in cfform flash

by Chris Velevitch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

<cfsavecontent variable="checkBoxChanged">
   if (Checkbox.selected == true) {
       mx.validators.Validator.enable( this, "myform.DateField");
   } else {
       mx.validators.Validator.disable( this, "myform.DateField");
   }
</cfsavecontent>

<cfinput type="Checkbox" name="haskeys"  label="I have my keys"
visible="Yes" enabled="Yes" onChange="#checkboxChanged#">


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au

Adobe Platform Users Group, Sydney
January '09 meeting: Looking Ahead To The Next Version Of Flex Builder
Date: Mon 19th January 6pm for 6:30 start
Details and RSVP http://groups.adobe.com/posts/b3ccf0d972

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: http://www.houseoffusion.com/groups/cf-flash/message.cfm/messageid:285
Subscription: http://www.houseoffusion.com/groups/cf-flash/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.30