jQuery UI Widgets Forums Form How to validate Form

This topic contains 3 replies, has 3 voices, and was last updated by  Fabrice 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • How to validate Form #101345

    Admir Hodžić

    First, thanks a lot for adding form componet.
    I hope this component is going to grow and become substitute for other 3th parity components we use to write and bind forms.
    I am trying to implement one.
    My question is .
    How to validate form.

    I see that there is required property in template.

    Bu I do not see any method or builtin functionality for validation

    Regarding this sample

    there is in required: true for fields but you can submit form whit empty requierd fields.

    • This topic was modified 8 months, 3 weeks ago by  admin.
    How to validate Form #101362


    The form does not offer built-in validation because each component can have its own specific rules. Furthermore, in some more complicated forms the validation result may depend on the values of more components and how they relate to each other.
    You can easily handle validation by binding to form events. You can either use the change event (formDataChange), which is triggered whenever the value of a component inside the form changes. You can also use the buttonclick event (e.g. when you click button inside the form). You can see the form events example here:


    In addition, you can get a reference to any of the internal components and bind to any event that they provide. To do that use the getComponentByName function. For example, if you have the following component inside the form:

                        bind: 'nubmberBoxValue',
                        name: 'numberinput1',
                        type: 'number',
                        label: 'Number input',
                        labelPosition: 'left',
                        labelWidth: '30%',
                        align: 'left',
                        width: '250px',
                        required: true

    You can get a reference to the component using this code:

                   var numberInput = sampleForm.jqxForm('getComponentByName', 'numberinput1' );
                   // Bind to any of event of the numberInput component or do something else with it

    Best Regards,
    Peter Stoev

    jQWidgets Team

    • This reply was modified 8 months, 3 weeks ago by  admin.
    • This reply was modified 8 months, 3 weeks ago by  admin.
    How to validate Form #101373

    Admir Hodžić

    Thank You a lot.

    In future version please considered to make API for error label.
    As we already can set custom texts for label and info.
    It will be great if we cloud set custom error message on form for component and call display if from code.

    How to validate Form #104459



    I used jqxValidator on a component belong to jqxForm.
    I just want to know if my way of doing this is correct ?

        var nom = mainForm.jqxForm('getComponentByName', 'nom'); // nom === jqxInput
            rules: [
                {input: nom, message: 'The username is required!', action: 'blur', rule: 'required'}
            ], theme: 'summer'

    it’s strange to set jqxValidator on ‘nom’ and assign input attribute with this same component ‘nom’ ?!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.