Menu icon Foundation
Abide custom validation returning True still invalid?

The following textbox allows the user to enter one to many names that are added to the guest list in the guestList below it. The textbox has a required attribute that is attached to a custom validation (see below).

<div class="grid-x">
  <div class="medium-4 cell">
    <input type="text" id="guestName" name="guestName" placeholder="Guest first & last name" data-validator="guest_count" required>
    <span class="form-error">
      At least one (1) guest name is required
    </span>
  </div>
</div>
<div class="grid-x">
  <div  id="guestList" class="medium-6 cell">
  </div>
</div>

 

When the form is validated this custom validation function is called, yet even with the test scenario below where it always returns True the field is considered "invalid". In practice the custom validation will check if at least one guest has been added.

  function guestCountValidator($el, required, parent) {
    return true; // ($('#guestList').children().length > 0);
  }

The textbox itself will always be blank when the form is validated but since there is a custom validation function I would expect it to be considered valid.

abideform validationcustom validation

The following textbox allows the user to enter one to many names that are added to the guest list in the guestList below it. The textbox has a required attribute that is attached to a custom validation (see below).

<div class="grid-x">
  <div class="medium-4 cell">
    <input type="text" id="guestName" name="guestName" placeholder="Guest first & last name" data-validator="guest_count" required>
    <span class="form-error">
      At least one (1) guest name is required
    </span>
  </div>
</div>
<div class="grid-x">
  <div  id="guestList" class="medium-6 cell">
  </div>
</div>

 

When the form is validated this custom validation function is called, yet even with the test scenario below where it always returns True the field is considered "invalid". In practice the custom validation will check if at least one guest has been added.

  function guestCountValidator($el, required, parent) {
    return true; // ($('#guestList').children().length > 0);
  }

The textbox itself will always be blank when the form is validated but since there is a custom validation function I would expect it to be considered valid.