'How to put a required field?

Why is the required attribute dont work?

<div class="Field">
  <div class="name">{name}</div>
  <div class="type"><input type="text" name="a_name" value="{$a_name}" required></div>
</div>
<div class="ProfileButtonSave">
  <div class="submitMiddleBlue" onclick="ButtonClick()">{#languageKey286#}</div>
</div>
<script>
  }

  function ButtonClick() {
    jQuery('#EditProfile').submit();
  }
</script>

 


Solution 1:[1]

Submitting the form using JavaScript bypasses the validation check.

Replace the <div> with a <button> (which has the extra benefits of making the page more accessible to screen reader and keyboard users) and remove the (now redundant) JS.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Quentin