2 Replies Latest reply on Sep 1, 2009 2:40 PM by paitkenhead

    Problem with date validation

    paitkenhead

      The enclosed trivial sample illustrates a problem I'm experiencing with validating dates

       

      The date field is initialized when the form opens.

       

      Once the form is open,  click the button and a popup appears saying there is a validation problem with the date field. Yet if the date is selected with the date selection widget the appearance is exactly the same, but without the validation problem. What's going on?

        • 1. Re: Problem with date validation
          paitkenhead Level 1

          I have more information. In the trivial case I provided, there are two form elements, a DateTime field and a Button.

           

          The "click" event on the button contains one Javascript invocation, "xfa.form.recalculate (1)"

           

          If I void out that click event, then my original problem of date failing to validate (in the DateTime form element) goes away. Furthermore if I type over the initialized date with a nonsense date (say, August 32) then I get date validation error as expected.

           

          So, why does it have a toxic effect on the DateTime field if the button click event invokes "xfa.form.recalculate(1)" ?

          • 2. Re: Problem with date validation... solved, but why is it solved?
            paitkenhead Level 1

            OK, I've solved this, but I am hoping some kind person can tell me why I solved it.

             

            On the trivial form I enclosed before before, the "click" script used to say

             

            xfa.forms.recalculate(1);

             

            Now I've changed it to

             

            xfa.forms.recalculate (0);

             

            And I no longer see the undesired date validtion errors when I click the button. (See updated enclosure on this post).

             

            The difference is supposed to be that, if the parameter is 0 (or false) then only "pending" calculation scripts are fired, and if 1 (or true) then all calculation scripts are fired. So what does it mean to my DateTime field having unjust validation errors? The DateTime field has no calculation script, only an iitialize script.