4 Replies Latest reply on Oct 19, 2013 11:49 PM by willrollo

    Empty Field Validation

      Title

      Empty Field Validation

      Post

           I want to alter the validation error message that appears it is not consistent with MY DB and May confuse things.

           I have a post code field that I want to contain data. 

            

           The problem is two fold.

           1/ Some Foreign addresses do not have a post code, but I do not want the error message appearing everytime the record is altered but this field left empty.

           2/ The error message itself - I would rather a dialogue message would appear that reminds the user to enter a post code. But this only happens once the record is first created. Maybe it can activate once the record is committed, like it does at present but with my message...

            

           Another issue i have is that I am importing quite a few (>1000) records from a previous database that contained only 4 address fields. This meant that sometimes the last field would consist of the county and the post code. Is there a replace field calc that I Could use that could test for two "words'  in Field 4 and if so copy the second "word" (post code) to my New Post code field? I know this wont work in every case but might work for most...

           Thank you

            

            

        • 1. Re: Empty Field Validation
          philmodjunk

               1) sounds like you can't validate for an empty field then. How do you distinguish between an address that requires a post code and one that does not?

               2) A validation error should appear each time a record with the error is committed--whether or not it is a newly created record, but you might investigate using the OnObjectValidate trigger to check for an empty field and use the script to display your own custom dialog. A message in a custom dialog can be a much less confusing message than the standard custom validation message from field options.

          • 2. Re: Empty Field Validation

                 Hi Phil

                 1/ - Uk Addresses (based on my Country field) will require a Post Code. What I want it a message to appear maybe when the record is committed that, on a uk country based record,  a message appears pointing out the requirement of a post code to the user.

                  

                 2/ I assume this would only work if the user enters the field and tabs to the next one, leaving the post code field empty? If so, would i validate by calculation as I have tried a few things bit nothing really worked how I expected - If you could expand a little on how the onobjectvalidate trigger works then that would be great...

                 I thought about trying to find error code for validation of field that is triggered when the layout is exited- would this be possible?

            • 3. Re: Empty Field Validation
              philmodjunk

                   1) then a validation by calculation can be defined:

                   IsEmpty ( self ) and Country = "UK" //use the correct field name for country and the correct value for United Kingdom as found in your database here

                   2) Yes, that is correct. But this runs a script so you can do all the things a script might do such as using an If step to check the value in fields (such as the expression in 1, but with a field name in place of "self") and then using show custom dialog to display the appropriate message and with just the buttons you want to use for managing the error. You'd use Exit Script [False] to return the user back to the appropriate field to correct the error and thus keep any built in validations such as 1) above from kicking in yet.

                   Note, script trigger validation is specific to the layout where you set it up. Field Validation is one setting that applies throughout your database. Thus, it is often a good idea to use both. Use the script trigger to keep things more user friendly, but have the field option validation in place as "insurance" against an error getting in if the user finds a "loop hole" around your interface design or you miss that detail somewhere on another layout...

              • 4. Re: Empty Field Validation

                     Seems to make sense. Will try it out. Thank you