Hey all,

Does anyone know a way within Spry to invoke the default validations from 
within a custom validation function?  What I am trying to do is verify that the 
end date is prior to the start date:

 

<script type="text/javascript">

<!--

            var afterStartDate = function(value, options){
                        var strStartDate = Spry.$("startDateInput").value; 
//start date form element
                        var stDate = new Date(strStartDate);
                        var currentDate = new Date(value);

                        if (currentDate > stDate) {
                                    success = true;
                        }

                        return false;

            }

            var startDate = new 
Spry.Widget.ValidationTextField("startDate","date",{format:"mm/dd/yyyy"});
            var endDate = new 
Spry.Widget.ValidationTextField("endDate","date",{format:"mm/dd/yyyy",validation:
 afterStartDate});

            

-->

</script>

 

The problem with the above code is that it does validate that the current date 
is greater than the end date, but it fails to check that the entered date is 
valid.  

 

For example, if startDateInput.value = '3/18/2008' and the value passed in to 
this function is '3/39/2008'.  Spry's built in validation would flag this value 
as invalid while JS parses the date as April 8th, 2008.   What I'd like to do 
is to utilize the existing date validation offered by Spry, but to add 
additional logic for each specific use case.  

 

I would like to add something like:

 

if ( endDate.validate() ) { // use spry to test validation first

                        return false;

            }

 

            … continue with custom validation

 

Has anyone found a way to accomplish this?

 

Thanks!

Rich 


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

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301494
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to