I’ve added custom input field with type number, how can I limit the numbers to be 4 only?
MaxLength is not working
This is the code: (I added the code to have one input field of type text, and the other is of type number and this is the one I am asking about)
{%- assign product_form_id = 'product-form-' | append: section.id -%}
{% if product.metafields.custom.needsName.value %}
<p class="line-item-property__field" style="font-size: 13px;">
<label for="{{ product_form_id }}-name">Type the Name. Maximum 5 characters</label>
<br>
<input form="{{ product_form_id }}" id="{{ product_form_id }}-name" type="text" name="properties[Name]" minlength="1" maxlength="5" style="width:100%; line-height: 40px; border:1px solid #333333;">
</p>
{% endif %}
{% if product.metafields.custom.needsDate.value %}
<p class="line-item-property__field" style="font-size: 13px;">
<label for="{{ product_form_id }}-date">Type the Year. Maximum 4 numbers</label>
<br>
<input form="{{ product_form_id }}" id="{{ product_form_id }}-date" type="number" name="properties[Year]” minlength="4" maxlength="4" style="width:100%; line-height: 40px; border:1px solid #333333;" pattern="[1-9]\d{3}">
</p>
{% endif %}
