Question

Detail validation

Hi Team

in detail wizard, there are four label fields in that I am tried validation on Name of Degree It allows only Alphabets if u enter Numerically it shows an alert box please enter valid text format.

the same process I am trying for another field (Institute name) but it's not working .please help me in this situation.

please check the following code once

Please find the attachment below.

Hoping For positive reply

        methods: {
            save: function()
            {
                var msg = this.Nameofdegreevalidation();
                if (msg.invalidMessage !== "") {
this.showInformationDialog(msg.invalidMessage);
                    return;
                }
                this.callParent(arguments);
            },
            Nameofdegreevalidation: function() {
                // Variable for storing a validation error message.
                var invalidMessage = "";
                // Variable for stroing the number check result.
                var isValid = true;
                // Variable for the phone number.
                var number = this.get("UsrNameOfDegree");
                // Determining the correctness of the number format using a regular expression.
                isValid = (Ext.isEmpty(number) ||
                    new RegExp(/^[A-Za-z]+$/).test(number));
                // If the format of the number is incorrect, then an error message is filled in.
                if (!isValid) {
                    invalidMessage = this.get("Resources.Strings.InvalidPhoneFormat1");
                }
                // Object which properties contain validation error messages.
                // If the validation is successful, empty strings are returned to the object.
                return {
                    invalidMessage: invalidMessage
                };
            }
        },

Like

1 comments

Hello manikanta,

Basically, the validation of detail fields should be in detail schema, not in page schema. The method which is responsible for saving new record is called "addRecord". Validation should be inside of this method. You can override it and add some custom logic of validation.

About Institute name field: the code that you sent should work nearly the same as validation of name of degree field, just follow recommendations from above.

However, usually setValidationConfig base method is used to add some custom validators. It`s more convenient way to validate the new record. Here is an example: https://academy.bpmonline.com/documents/technic-sdk/7-13/how-add-field-…

Best regards,
Alex

Log in or register to comment