Home > X++ stuffs > Validating TabPage Fields Dynamically

Validating TabPage Fields Dynamically

 

This article is to my lovable sweetheart AnithaSantosh.

I would like to share a small piece of information on validation stuff at form level. The requirement is something like doing basic validation. All fields at the form level needs to be filled in; else it needs to update the user that the specific fields’ information is missing.

All the field validation is basically done at the table validate Field method. If the form design is changed time to time then the code also needs to be updated which isn’t a good practice.

I took a small example to showcase how we can achieve the requirement.

I have custTable form which maintains customer details and payment is important information which is required when we make any sales order. If the basic payment information is not filled in while creating customer details then system has to update the user that all details under payment tab needs to mandatorily filled in.

1) Set Auto declaration to ‘Yes’ for payment Tab under custTable form design

2) Under validateWrite of the custTable datasource add the following logic.

    for (i=1; i<= payment.controlCount (); i++)

    {

        if (payment.controlNum (i).valueStr () == ”)

        {

            warning (strfmt ("%1, %2, %3", i, strdel (payment.controlNum (i).name (), 0, 8), ‘Mandatory to be filled in.’));

        }

    }

So basically before the Cust details are saved it checks whether all fields under payment Tab is filled else it will throw warning will the furnished details.

63952849.jpg

Note: No. indicates fieldNum

This is just a basic information which i felt would be useful tip Smile Happy Daxingggg Hot

 
Advertisements
Categories: X++ stuffs
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: