Hi, I am fairly new to this so need a small bit of help. I am trying to have a checkbox become dynamically unchecked after a certain date, allowing our business' specials to finish and not show at the special price anymore. I have played around for a bit but seem to be having some problems. It is date dependant, so if the date expires so should the special price and uncheck the box. Some of the code I'm looking at is as follows for the specification of the date: <TD nowrap><B>End Date*:</TD> <TD bgcolor=ffffff><input type="text" name="itemend" value="#dateFormat(itemend,'dddd, dd mmmm yyyy')#" ControlSize = "80"></td> And the checkbox that I want to have unchecked if the date is passed: <td><input type="checkbox" name="IO_#itemoptionid#_itemsale" value="1"<cfif itemsale> checked</cfif> <font color="#fontcolor#">YES @ $ <input type="text" name="IO_#itemoptionid#_itemsaleprice" value="#Decimalformat(itemsaleprice)#" size="5" style="text-align: right;" #readonly#></td> Also if there is no data in the end date section then this shouldn't mke any difference as the item shouldn't be checked. Is there an easy way to do this? Cheers in advance, Dallas
<cfset itemoptionid = 1> <cfset itemsaleprice = 20.00> <cfset _date = now()> <cfset _expired = dateadd("h",-1,_date)> <cfset itemsale = iif(_date lt _expired,true,false)> <cfset _value = dateFormat(_date,'dddd, dd mmmm yyyy')> <cfoutput> <input type="text" name="itemend" value="#dateFormat(_value,'dddd, dd mmmm yyyy')#" ControlSize="80"><br> <input type="checkbox" name="IO_#itemoptionid#_itemsale" value="1"<cfif itemsale> checked</cfif>> YES @ $ <input type="text" name="IO_#itemoptionid#_itemsaleprice" value="#Decimalformat(itemsaleprice)#" size="5" style="text-align:right;" <cfif not(itemsale)>disabled</cfif>> </cfoutput>
<html> <head> <script type="text/javascript"> function check(){ var x=document.forms.myForm x[0].checked=true } function uncheck(){ var x=document.forms.myForm x[0].checked=false } </script> </head> <body> <form name="myForm"> <input type="checkbox" value="on"> <input type="button" onclick="check()" value="Check Checkbox"> <input type="button" onclick="uncheck()" value="Uncheck Checkbox"> </form> </body> </html>