Hi all,

*purpose & Research*

I am currently working on a task that do client-side validation for the
Enterprise Store - Publisher.As for now we have server-side validation by
asset RXT. For example it checks whether the field is required or readonly
as well as validation for URL.I would like to propose a design for
pluggable client-side validation using JQuery validator.

JQuery validation plugin makes simple client-side form validation easy and
gives plenty of customization options.

Advantages of JQuery validation plugin

     - Set of validation methods
     - Default error messages
     - It's providing API for writing our own methods
     - I18n support -(Error messages can be translated into 37 other
languages)

*Proposed Design view*


​
    - Include another property called client-side-validation in asset.js
    - define a custom validation called validations.js in the js folder

Here I can explain with the example

 fields: {
                    provider: {
                        readonly: true
                    },
                    name: {
                        name: {
                            name: 'name',
                            label: 'Name'
                        },
                        updatable: false,
                        validation: function () {
                        }
                    },
                    version: {
                        name: {
                            label: 'Version'
                        }
                    },
                    createdtime: {
                        hidden: true
                        *client_side_validation* : {

"name" : "*time_validator*",

"params" : { "K1" : V1 , "K2" : v2 },

"sucess_message" : "validation sucess",

"error_message" : "validation unsucess"
                                                               }

                    }
             }

And the custom validator method in validations.js file

jQuery.validator.addMethod(name,method[,message])

jQuery.validator.addMethod("*time_validator*",method,message);

So when the function call by proper validation name It will be validate the
field which satisfy the validations regarding to that function and will
give proper success message or error message.

please find the references about jQuery validator[1]
[1] - http://jqueryvalidation.org/

Please share your thoughts.

-- 

*Thank You.*

*Rajeenthini Satkunam*

*Associate Software Engineer | WSO2*


*E:[email protected] <[email protected]>*

*M :+94770832823 <%2B94770832823>   *
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to