Hi,
Note that you don't need this to be added as an attribute. A cleaner way is to add it as javascript code in a view override.
For example in product / show_default.php you could add:
<script>
var field = document.getElementById("xxx");
if(field) {
field.addEventListener('input', function(){
if(this.value>950)this.value=950;
});
}
</script>
where xxx is the id of the input on the page.
There are several advantages to this:
- you don't need to use the attribute setting, so there are no restrictions to what you can do in it.
- having javascript code inside the database is not "clean". Code should ideally be in files. This way, you can also have coloration on the code to make it easier to write / maintain
- you can improve this code to add a notification box and potentially other things in the future more easily.
- if you have different fields for different products, you can have all the code in one place in that override instead of spreading it in different custom fields in the database. That way, if different fields require the same processing, they can use the same function and thus avoid cod duplication.
- using addEventListener instead of oninput, onchange etc is better because you can have several listeners on an input while you can only have one oninput and one onchange, etc attribute per HTML element.
- you don't need to wait for the patch in the next version.