- Issue created by @smulvih2
- 🇨🇦Canada smulvih2 Canada 🍁
Here are the fields with the proper rendering.
You can pull these changes from this PR until merged - https://github.com/drupalwxt/wxt_bootstrap/pull/35
- 🇨🇦Canada smulvih2 Canada 🍁
So far there is only one major issue with the WET-BOEW field validation integration with webforms, this is with the checkboxes field. WET-BOEW expects all checkboxes in a group to have the same name attribute on each
<input>
element, like this:<fieldset class="chkbxrdio-grp"> <legend class="required"> <span class="field-name">Favourite pets</span> <strong class="required">(required)</strong> </legend> <div class="checkbox"> <label for="animal1"> <input type="checkbox" name="animal" value="1" id="animal1" data-rule-required="true"> Dog </label> </div> <div class="checkbox"> <label for="animal2"> <input type="checkbox" name="animal" value="2" id="animal2"> Cat </label> </div> ... </fieldset>
You can see from this example, WET-BOEW expects all
input
elements to have the samename="animal"
. With webforms, thename
attribute is unique and used to save the value on from submit, so can't easily be changed. Here is the same field in webforms (some attributes removed for brevity):<fieldset class="chkbxrdio-grp"> <legend class="required"> <span class="fieldset-legend">Select from the following</span><strong class="required">(required)</strong> </legend> <div class="fieldset-wrapper"> <div class="form-item checkbox"> <label for="edit-select-from-the-following-1"> <input class="form-checkbox" type="checkbox" id="edit-select-from-the-following-1" name="select_from_the_following[1]" value="1"><span class="field-name">Option 1</span> </label> </div> </div> <div class="fieldset-wrapper"> <div class="form-item checkbox"> <label for="edit-select-from-the-following-2"> <input class="form-checkbox" type="checkbox" id="edit-select-from-the-following-2" name="select_from_the_following[2]" value="2"><span class="field-name">Option 2</span> </label> </div> </div> ... </fieldset>
You can see here that each
input
element gets a uniquename
attribute, which can't be changed or will cause submission failure. Not sure the best way to approach this issue, maybe WET-BOEW has a workaround for this, but nothing I can find.Symptoms: When the checkboxes group is required, and you submit the form with the field blank, you get the error message as expected. Only selecting the first checkbox in the array will clear the message, although if you save the form it will then remove the message if another checkbox in the array is selected.