Skip to content

Required attribute in some cases does not work in combination with allowclear

Steps to reproduce:

  • use tokens field with required, placeholder, multiple, allowclear
  • select some token options
  • clear them with with the allowclear x on the right side of the token field
  • submit form
  • it will be submitted, while it should have stopped and given a notice about the required field

Example form for testing:

<form action="get">
<_token name="car[]" id="test-tokens-multiple" multiple="multiple" placeholder="Select one ore more"required="required" allowtags="allowtags" allowclear="allowclear" >
<option value="volvo">Volvo</option>
<option value="saab" selected="selected">Saab</option>
<option value="tesla" selected="selected">Tesla</option>
</_token>
<input type="submit" />
</form>

Tested with versions:

  • FlexForm 2.63 (dev branch) and MW 1.39
  • FlexForm 2.6.1 and MW 1.43
Edited by Liselot Roelen