AbanteCart Community

AbanteCart Development => Customization help => Topic started by: Mike on December 22, 2016, 11:24:37 AM

Title: Max characters text box
Post by: Mike on December 22, 2016, 11:24:37 AM
Hi Guys

A couple of product which we offer on our site have an option to add engraving.

At the moment I have a textbox on the product page where the customer can enter the message that they want to have engraved.

Does anyone know of a way to limit the characters which can be entered - for example:
Max 20 characters with the 20 displayed and counting down as characters are entered - I'm sure you've seen the sort of thing I'm talking about.
Title: Re: Max characters text box
Post by: Basara on December 23, 2016, 12:21:21 AM
Hi. Every option in AbanteCart have Regular Expression Pattern and Error Message about invalid Value fields.

Try them for allow only 20 chars. For the counting while typing customization required... some simple javascript
Title: Re: Max characters text box
Post by: Mike on December 23, 2016, 03:15:01 AM
Thank you.

I don't know Javascript but after a bit of googling and a couple of visits to Stack overflow I have managed to get something that works.

            /^.{,40}$/

It doesn't show a countdown box as the user types but it does limit the characters to a maximum of 40.

If anyone knows how to add a countdown box then please share :)