NetTalk Central

Author Topic: a way to restrict form fields automaticly validated  (Read 3023 times)

kevin

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
a way to restrict form fields automaticly validated
« on: April 13, 2014, 02:21:21 PM »
Is there an option to restrict automatic file field verification to only the only file fields used on a form rather than all fields. For example in a Clarion app field validation is only applied to fields actually on the screen. NT generates checks all fields in the file.

This occurs when a file record is optimised and may represent multiple options. In C9 you can set fields required for each option in the DCT and not populate, hide or disable the fields depending on which option is selected, maybe during input, and they will be omitted from validation.

Cheers for any suggestions.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: a way to restrict form fields automaticly validated
« Reply #1 on: April 13, 2014, 11:03:39 PM »
Hi Kevin,

>> Is there an option to restrict automatic file field verification to only the only file fields used on a form rather than all fields.

no. Because once the nettalk validation is done, the ABC validation will take place. And that tests all the fields. An error there is not seen by the user, and the record is not saved, so that's bad.

Indeed the whole concept of dictionary validation being "optional" does not exist in clarion. If you have "optional" validation then you need to apply that at the procedure level, and remove it from the dictionary. Dictionary rules are "always valid" - not optional.

>>  In C9 you can set fields required for each option in the DCT and not populate, hide or disable the fields depending on which option is selected, maybe during input, and they will be omitted from validation.

that's not true - at least not for ABC.

cheers
Bruce

kevin

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: a way to restrict form fields automaticly validated
« Reply #2 on: April 14, 2014, 04:12:34 PM »
Hi Bruce

Thanks for the clarification re validation. There is still something happening I can't sort out.

Not all validation seems to be generated In the BCx file for both the win app in C8, even though the DCT fields are defined exactly alike.

Example:
Hide:Access:OS4perma.ValidateFieldServer PROCEDURE(UNSIGNED Id,BYTE HandleErrors):

the BCT generates checks for 5 fields  defined as s(3) with Must be in list No|Yes with string radio options defined without values. But it does not generate code for other fields that are defined in exactly the same way - Why would this be?

Example code generated a field:
 OF 34
    GlobalErrors.SetField('Incident Investigated [No/Yes]')
    IF INSTRING(']' & CLIP(OS4:Investigated) & '[', ']No[]Yes[', 1, 1) = 0
      ReturnValue = Level:Notify
    END
    IF ReturnValue <> Level:Benign
      IF HandleErrors
        ReturnValue = GlobalErrors.ThrowMessage(Msg:FieldNotInList,'''No'',''Yes''')
      END
    END

But in the same file OS4:Shift (s10) Must me in list: Day|Afternoon|Night
- nothing generated.
and another OS4:CouldHaveBeenSerious (S3) Must be in list: No|Yes (no values)

So I guess my questions are:

1. In a win app/web app when is validity checking generated in in the BCx's?
2. In a win app Is each field verified when the record is added/updated or only if the field is touched?
3. From what you say each field is verified in a NT app due to the dynamic nature of the three form passes so validation does not fail at the update record stage but does a win app actually enforce DCT validation if an Option field is not touched?

Cheers
Kevin

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: a way to restrict form fields automaticly validated
« Reply #3 on: April 16, 2014, 12:35:52 AM »
can you post the dict (to me privately maybe) so I can duplicate the effect here?

>> 1. In a win app/web app when is validity checking generated in in the BCx's?

as far as I know - always.

>> 2. In a win app Is each field verified when the record is added/updated or only if the field is touched?

the record is verified on save. It has nothing to do with the form.

>> 3. does a win app actually enforce DCT validation if an Option field is not touched?

I believe so.

cheers
Bruce