I am having a stupid issue with a form. I have always used the ‘required’ attribute in an input box for quick validation, but now for some reason when I am using a button instead, the validation is not running? Does it just not work with a button or am i doing something wrong? Something that could be causing issues, is that the the required fields are sometimes readonly. Is there maybe a conflict? Below is some example code:
This would be my input box:
<input type='text' id='something' name='something' required />
and this would be my submit:
<input type='submit' value='Submit' />
But now I am trying to use this:
<button type='submit'>Submit</button>
Thanks in advance. Any help would really be appreciated.
For anyone experiencing the same issue, you cannot have required and readonly in an input field. Just try do without or maybe use some JavaScript to help out.