validetta icon indicating copy to clipboard operation
validetta copied to clipboard

Nested form validation problem

Open emr opened this issue 5 years ago • 0 comments

<div class="form-group">
  <div role="radiogroup">
    <label>
      <input type="radio" name="group" value="1" data-validetta="required" data-vd-parent-up="2" />
      Group value 1
    </label>
    <label>
      <input type="radio" name="group" value="2" data-validetta="required" data-vd-parent-up="2" />
      Group value 2
    </label>
  </div>
  <div class="form-group group-1">
    <input data-validetta="required" \>
  </div>
</div>

Validetta is running on that form. When I submit the form, new markup looks like (as expected):

<div class="form-group">
  <div role="radiogroup">
    <label>
      <input type="radio" name="group" value="1" data-validetta="required" data-vd-parent-up="2" />
      Group value 1
    </label>
    <label>
      <input type="radio" name="group" value="2" data-validetta="required" data-vd-parent-up="2" />
      Group value 2
    </label>
  </div>
  <div class="form-group group-1">
    <input data-validetta="required" \>
+   <div class="error-message">This field is required. Please be sure to check.</div>
  </div>
+ <div class="error-message">This field is required. Please be sure to check.</div>
</div>

But when I submit the form second time, I getting this error on the browser console:

Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

emr avatar Feb 13 '20 07:02 emr