Is query validator with dynamic error validation not supported?

5 replies · opened Mar 31, 2022

VvivekprvrMar 31, 2022

I was trying to use jqueryvalidator like the below code. Is there a way to use validation like this in canvas?

$("form[name='registration']").validate({
    // Specify validation rules
    rules: {
      // The key name on the left side is the name attribute
      // of an input field. Validation rules are defined
      // on the right side
      firstname: "required",
      lastname: "required",
      email: {
        required: true,
        // Specify that email should be validated
        // by the built-in "email" rule
        email: true },

      password: {
        required: true,
        minlength: 5 } },

    // Specify validation error messages
    messages: {
      firstname: "Please enter your firstname",
      lastname: "Please enter your lastname",
      password: {
        required: "Please provide a password",
        minlength: "Your password must be at least 5 characters long" },

      email: "Please enter a valid email address" },

    // Make sure the form is submitted to the destination defined
    // in the "action" attribute of the form when valid
    submitHandler: function (form) {
      form.submit();
    } });
SSemicolon WebSTAFFMar 31, 2022

Hello,

This is Definitely Possible, but to use Custom JS Code, you will need to disable the Default Functionality by adding the .customjs Class to the .form-widget Element.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

VvivekprvrMar 31, 2022

Thank you very much,
We need to add this also in custom CSS. Right? or is there some other way for this?


label.error {
	display: block !important;
}
SSemicolon WebSTAFFMar 31, 2022

Hello,

You can simply add the .show-error-msg Class to the .form-widget Element.

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

VvivekprvrApr 1, 2022

Adding .show-error-msg Class to the .form-widget element is not working.
But modifying the custom CSS works.
.customjs Class was added to the .form-widget element in both cases
I guess I might be missing something

SSemicolon WebSTAFFApr 4, 2022

Hello,

Apologies for the delays in replying.

Can you please provide us with a Live URL so that we can check out the exact issue and provide you with more accurate assistance on this. Thanks for your Patience.

Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard