4 Replies Latest reply on Feb 14, 2012 6:13 AM by jl535156

    DateField <= Today's Date and AmountEntered Field Limit (Adobe Form Non Web JavaScript)

    jl535156

      Hi All,

       

       

      I was struggling with both these Validation but figured out how to do it.

       

      1. If you have a Date Field where you don't want to allow a Date Entered that is beyond the Current Caldender Date (Today's Date), use this code in the field's Properties-Validation

       

      if (event.value!="")

      {

        var d = util.scand("mm/dd/yyyy", event.value);

        if (d.getTime()>Date.now())

        {

        app.alert("The Purchase Date may not be later than today's date");

        event.rc = false;

        }

      }

       

       

      2. If you have an Amount Field where you don't want to allow an amount over a certain Amt, use this code in the field's Properties-Validation

       

       

      if (event.value!="" && Number(event.value)>99999999.99) {

          app.alert("The maximum allowed number is: 99,999,999.99");

          event.rc = false;

      }

       

       

       

      Note:  The 99999999.99 is the limit amount of my field.

       

       

      You can manipulate this code to do similar things like have a Date be greater than Todays Date or having an Amount field to have an minimum value by changing the ">" to a "<".

       

      Hope this helps!!