Currently there are no constraints or validation for address lines. The DB truncates them to 256 characters but there's no other checks.
I need to ensure they are no greater than an arbitrary length without affecting other portions of cscart.
If I edit or override the template I affect everyplace profile_fields.tpl gets used.
This doesn't seem like the right answer to me.
Any thoughts? Is there any place to set validation paramaters?
I suppose I could add a bit of js to check.
I suppose I could add a bit of js to check.
By far the easiest if you know what you need to do. There are some form validation elements built into cs-cart. See this article for details: https://docs.cs-cart.com/4.1.x/core/front-end/microformats.html
As alternative you can override section with fields using the profiles:profile_fields hook (design/themes/THEME/templates/views/profiles/components/profile_fields.tpl)
Simply add maxlength attribute to input elements
As alternative you can override section with fields using the profiles:profile_fields hook (design/themes/THEME/templates/views/profiles/components/profile_fields.tpl)
Simply add maxlength attribute to input elements
I thought about that but then I'd still end up overriding it for all the simple input text types. I may end up doing this still after I think it through some more.
Yeah I was reading through that yesterday. Thanks
Adding the attribute via jQuery is an alternative and keeps you from having to manage 20 overrides. A loop on the id's based on controller/mode context should make it quick and relatively easy.
Try something like
$('.ty-profile-field__item input').each(function() {
$(this).prop('maxlength', 255);
});