Using webform4, how to programmatically toggle the required option based on another condition? I have done jQuery('#edit-submitted-fld4-rgistered-with').removeClass('required'); but it seems the validation is handled on the server side.

  • If field configured as required in drupal then you cannot move to form submission, Server side form validation will handle this, even if you try removing required attribute from front end also, it will not effect. Commented Oct 15, 2014 at 15:32
  • You may try with Webform Conditional module Commented Oct 15, 2014 at 15:38
  • According to this page drupal.org/node/1526208 Webform Conditional is not compatible with webform4.
    – Ura
    Commented Oct 15, 2014 at 15:43
  • 1
    I have a possible solution: Disabled required field on server, added jquery condition for HTML5 validation $('#fld').prop('required',false);
    – Ura
    Commented Oct 15, 2014 at 15:47
  • 1
    Then make your field non-manditory & from front end add required attribute or class to that field then toggle it by on your conditions :) Commented Oct 15, 2014 at 15:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.