1 Reply Latest reply on Mar 4, 2016 12:10 PM by jasotastic81

    Date Field YYYY only and validation message.

    PCForm

      I have a date field "Policy Term" formatted as MM/DD/YYYY. And another text field "Year Built" no format.

       

      I need to write a script for this scenario.

      If the "Year Built" > the "Policy Term" (YYYY format) date field, it will give a validation message " " then "xfa.host.setFocus(this)" to the Year Built field.

        • 1. Re: Date Field YYYY only and validation message.
          jasotastic81 Level 3

          Do you need an actual validation message that prevents submitting?

           

          If not, here's a quick option. I'm presuming this is an event that is called by the Year Built field since you used "this" as the parameter for your function.

          if (this.rawValue > parseInt(dfPolicyTerm.rawValue.substr(0,4))){

            xfa.host.messageBox(" ");

            xfa.host.setFocus(this);

          }