Is creating an extension the only solution for validating custom fields?

In my frontend store I have a custom line property like so:

In case the user inputs a value greater than 99 or less than 1, I want to assign the object property.last in ‘{% for property in item.properties’ %}'s body to 99 and 1 respectively. But since property.last is an immutable object is creating a new extension just to validate two of my custom fields the only way to go?

Why you are not using JavaScript without creating a new extension? Add a script that listens for form submission, checks the value of your custom property input, and updates the value if it’s outside the desired range before the form is submitted.

Yes I’ve done that. What I’m looking for is a server side validation.