javascriptformsvalidationplonez3c.form

How can you disable inline validation for a z3c.form on Plone?


I have a wrapped form that is custom. Inline Validation is having a fit because the javascript runs into error because the input data.errmsg is null and it can't handle that.

It spits out this traceback:

2014-12-16 16:28:15 WARNING plone.protect error parsing dom, failure to add csrf token to  
response for url http://localhost:8080/Plone/.../@@questionsinglepart/@@z3cform_validate_field

For an error in this part of the inline javascript:

   if (fname) {
     $form.ajaxSubmit({
        url: append_url_path($form.attr('action'), '@@z3cform_validate_field'),
        data: {fname: fname, fset: fset},
        iframe: false,
        success: function (data) {
          render_error($field, data.errmsg);
         },
          dataType: 'json'
      });
    }

How can I disable the inline validation for a form so I don't get the errors when it attempts to validate?


Solution

  • There may be more official ways to do this, but I find that injecting a JavaScript one-liner on relevant pages (in your templates) or globally (in portal_javascripts or via viewlet) solved my problems with this:

    $('.z3cformInlineValidation').removeClass('z3cformInlineValidation');