Form input maxlength error
Posted: Thu Sep 06, 2018 12:35 pm
Code: Select all
<fieldset style='border: 1px solid black; width: 975px; height: 250px;'>
<legend>Description</legend>
<p>
<label for='tag'>Tag ID:</label>
<input type='text' id='tag' name='tag' size='4' maxlength='4' value= '<?php if ($old){echo "123";} ?>'>
</p>
</fieldset>
If I change maxlength='5' then of course the fragment validates.The "maxlength" attribute specifies a maximum length of 4, which is less than the length of the value of the "value" attribute (which is 5). The length of the value of the "value" attribute must be equal to or less than the length specified by the "maxlength" attribute.
---
1 message for line 5
This fragment is part of a PHP script data entry screen. If after a user enters data an error is detected the user is returned to the same screen, displaying the original data ~~ if($old) { echo "";} ~~. Conditional style = ' ' (not shown) are also used to highlight the fields with errors. There is also a popup box with error messages.
The tag data is a 1-4 digit number matching an inventory tag number. I don't want the user to be able to enter 5 digits.
Where does the 'length of the value of the "value" attribute (which is 5).' come from? If the value= does not include a script, things work as expected.
PRO version 2018(v18.0300)