4 Replies Latest reply on Jan 17, 2013 8:27 AM by RamanC

    Need to restrict the User enterable field from Negative values ?

      I have one UE field.
      If one user enters the value which is less than 0(Negative value) and he gives a tab out, there we need to restrict field and saying to user like "Value should be greater than 0" .After this popup comes then cursor should be there in the field itsef for user can re-enter the values which is greater than 0.
      Is this possible ?

      1.Field type as Numeric only.
      2.For Pop up i have used MSG ("Value should be greater than 0")

      Please suggest any other way to do this ...

      Thanks & Regards,
      RAMAN C.

      Edited by: Raman C on Jan 16, 2013 5:04 AM
        • 1. Re: Need to restrict the User enterable field from Negative values ?

          You can use Setedit function to focus again to the same field if it is a negative value.

          Use below dal script for the field which you are using:

          Say field name you are using is "FIELD_NUM"

          if(#Value<0) then
          MSG("Value should not be greater than zero");

          Sai krishna
          • 2. Re: Need to restrict the User enterable field from Negative values ?
            Gaétan Berthold
            Hi Raman,

            I don't know which version of Documaker (or iDocumaker) you are using, so this might not be relevant.

            Under version 11.3 and previous, the validation script should appear as a post-edit process. You should be aware that the post-edit process is only triggered by the TAB key: using the mouse to get out of the field and move to another field will not trigger the post-eidt process.

            For that reason, you may also want to add a Section post-edit process to re-validate the conten of the field.

            • 3. Re: Need to restrict the User enterable field from Negative values ?
              Mr Peabody-Oracle
              You should use DAL calc on the field as suggested. You did not note whether the value can have a decimal or not. If so, then you should use $value rather than #value as someone suggested. Otherwise, you might think 0.1 is zero when it is not.
              Your script can return a value for the field. So, if your field is REQUIRED then it can't be left as zero. So after if you just return "0 from the script, I think the user will get the "field is required" message.
              The DAL calc should be set to "this field" rather than "all fields" or you will do the check over and over on every edit unnecessarily.
              Also, all versions should perform the post edit whether you tab or click off the field. However, clicking off the field will try to override control to where you go next. If it didn't, then you would never be able to get off a field when you don't know what value to enter. Tab will allow you to set back to the field because that is considered a "softer" exit. That is another reason you should return a value from the script to set the field back to zero - or some default that you will accept. Otherwise, a subsequent required check will not flag the field again.
              • 4. Re: Need to restrict the User enterable field from Negative values ?
                Hi All,
                Thanks for reponse. I have used the script as below by using SETEDIT funtion,

                userval = @()
                if userval < 0
                MSG("Enter the Positive Values");
                setedit("My filed Name")

                It's working fine as expected.
                I dont have any explore on PostEdt process in the fied properties.But that is also good option while do the validation when tab out.But for this scenario it didnt work
                as we expected.So i have used above script in Field properties under Calculation and select "this field" in the Execution section.

                I have used Post-Edit and Pre Edit only for Look up table entries. I'll explore this Post-Edit process when requires.Thanks for let me know this concept as well.

                Thanks to @Sai Krisha @Gaeten and another person who replied.

                RAMAN C

                Edited by: Raman C on Jan 17, 2013 12:26 AM