AnsweredAssumed Answered

Date Validation in SC Form

Question asked by hernanlo_ on Apr 21, 2016
Latest reply on Apr 22, 2016 by Jason_Wolfe

Hi guys,

     I have a form in wich i have two dates (start_date and end_date),  i'm trying to validate that the end_date is grater than start_date after the end_date is selected. So i have created a script:


   x : function() {

       if (end_date < start_date)

        alert('End date must be grater than Start date');




So i call the function this way:  ca_fd.js.x(). But when i try to call the function from the attribute OnValidate in the Date property form i can't save it. So i have some questions:

1. In my if statement "if (end_date < start_date)", how should i reference the atributes ids for end_date and start_date?

2. Where should i place my function to execute, in other what property should i call it? (Onvalidate,OnkeyUp, etc)

3. How can i validate this and prevent to submission of the form if end_date does is lower than start_date.

4. Is there any way to not show lower values in end_date considering the start_date selected?


Let me know if you have any questions about this post.


Thanks in advance guys!