html-forms icon indicating copy to clipboard operation
html-forms copied to clipboard

When using condition "HIDE IF" and then unhide the "required" parameter is not added back to the field

Open arnelap opened this issue 2 years ago • 0 comments

To replicate, make a form with this code:

<p>
  <label for="SELECT_1">Select a option</label>
  <select name="SELECT_1" required id="SELECT_1">
    <option value="" disabled selected hidden>Select</option>
    <option value="One">One (hides the text field)</option>
    <option value="Two">Two</option>
  </select>
</p>
<p data-hide-if="SELECT_1:One">
	<label for="HIDDEN_TEXT">Text field (is hidden if you select one)</label>
	<input type="text" name="HIDDEN_TEXT" required id="HIDDEN_TEXT" />
</p>
<p>
	<input type="submit" value="Absenden" />
</p>

Choose One to hide the required field, then choose Two to show it again. The field is no longer required.

arnelap avatar Oct 17 '22 16:10 arnelap