Hello,
I wonder if someone can help me.
In my product page I want to offer a gift card. I have created the Select Box dropdown, but I need to create a Text Area. I have no idea how to use Regexp. In the Text Area i want to limit the number of characters someone can type.
Can someone help or make some suggestion.
Greatly appreciate some help.
thanks
Dear Goia007,
Could you please specify do you want to add this gift card in product option? Or what?
[quote name='goia007' timestamp='1418243402' post='199398']
In the Text Area i want to limit the number of characters someone can type.
[/quote]
You may use maxlength attribute
```php
Enter text here...
```
Best regards, Alt-team.
[quote name='Alt-team' timestamp='1418285436' post='199431'] Dear Goia007, Could you please specify do you want to add this gift card in product option? Or what? You may use maxlength attribute Enter text here...
Best regards, Alt-team.[/quote]
Hello Alt-team.
I have added 3 images
- image 01.gif my product page in store front. I have added an option Gift Note (No/Yes) and Message (text area) with options.
- Message box image 01.gif. If you look at image 02.gif, Option fields, Type: Text area, Inner hint: max 14 characters (example only). When you type something in the Inner hint it appears inside the text area. That is fine, but I want to limit the number of characters withing the text area.
- image 03.gif, this was cut out from a web site I shop from. If you notice the box has 5 lines avialable, 35 charaters remaning this time. This is what I want to achieve in the text area.
I don't no anyting about Regexp, but did a search in CS Cart forum and found this string ^([^\r\n]{0,10}(\r?\n|$)){1,4}$, something about it limits the number of charaters to 14. I put this in (image 02.gif) RegExp field, but did not do anything.
Do you know of an easy way to do this or this needs to be hard coded into the tpl files?
I was thinking of maybe creating a block/form/option, but do not know if this doable within CS Cart.
Your help is greatly appreciate on this matter.
Thank you again.
Try this regular expression:
<br />
^[\s\S]{0,10}$<br />
```<br />
<br />
where [b]10 [/b]is the limit of characters. Can be tested here:<br />
<br />
http://regexpal.com/
[quote name='eComLabs' timestamp='1418312592' post='199505']
Try this regular expression:
^[\s\S]{0,10}$
where 10 is the limit of characters. Can be tested here:
[url=“http://regexpal.com/”]- Regex Pal
[/quote]
[quote name='eComLabs' timestamp='1418312592' post='199505']
Try this regular expression:
^[\s\S]{0,10}$
where 10 is the limit of characters. Can be tested here:
[url=“http://regexpal.com/”]- Regex Pal
[/quote]
eComLabs,
thank you for response, I added this (see image attached) to RegExp field in the options, cleared cache and not working. Does this string need to be hard coded? Anything I put in the RegExp field nothing happens.
thank you for your help.
I got it how it works, i added string ^[\s\S]{0,10}$ RegExp field in options then you must also type the error message that will appear as in error in “Incorrect filling message”. Save. refresh your site. Test. if you type more than 10 characters and hit Add to Cart the Error message appears not letting the customer move forward till it's fixed.
Well thanks for help anyways.
[quote name='goia007' timestamp='1418335801' post='199517']
I got it how it works, i added string ^[\s\S]{0,10}$ RegExp field in options then you must also type the error message that will appear as in error in “Incorrect filling message”. Save. refresh your site. Test. if you type more than 10 characters and hit Add to Cart the Error message appears not letting the customer move forward till it's fixed.
Well thanks for help anyways.
[/quote]
We are glad to hear that problem is solved.