I have just started using Javascript, and am now using some objects and methods etc. that I did not even know about. It's progressing rather well, now I need to know some Livecycle Designer Basics that I can't seem to answer from my searches.
Here's what I am trying to do in English:
I want users to choose a date that they will miss at our Farmers Market. I have the date field on the form - works well.
I want to validate the entry for:
The date must be today or in the future
AND
The date must be before the closing date
AND
The date must be a Saturday
Here's some script I've written and placed in the Validation Event (I have actually written more for testing out that the results are coming out properly):
----- form1.#subform[0].Missdate::validate - (JavaScript, client) ----------------------------------
var entereddate = this.rawValue;// The date vendor will not attend as entered on the form
var dentry = new Date(entereddate.slice(0,4),[entereddate.slice(5,7)-1],entereddate.slice(8,10),0,0,0); // month starts at 0!
var closingdate = "October 04,2008" // closing date of the market
var today = Date();// today
(dentry.getDay() = 6);// and attempt to validate that the day = Saturday - nothing happens!
But now -
How do I actually validate this - my last statement seems to be ignored. How to I force a 'false' being returned? In Formcalc I simply put a camparison statement here and if it resulted in 'False' validation failed and if it resulted in 'True' it passed - What's the JS equivalent? Or are the variables giving me troubles?
Maybe I'm putting this in the wrong Event? If so which one should I place it in.
I want to force the user to enter the correct data - how do I code this - and put in a custom message refering to this. I may even get fancy and ask the user if the next Saturday is what they meant if they enter the incorrect one (this will be a real challenge!)
I think I'm lacking some basic knowledge here that other posts have assumed. Please refer me to any help pages as well - although I've done extensive searching on this and have not really found a good explanation of Validation - only specific pages that are not basic or general enough for my understanding. Thank!