The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.
 
 
Thread Tools Display Modes
  #1  
Old 10-03-2016, 08:01 PM
Rooftop Post's Avatar
Rooftop Post is offline
Junior Member
 
Join Date: Oct 2012
Posts: 2
Default

How to limit characters in Ecwid form fields


Hi,

I'm trying to work out how to limit the characters in the text field of a given product. (I sell personalised products and I only have room for a certain number of words.)

Can anyone tell me if setting max characters is possible?

Thanks for your time.

Last edited by Rooftop Post; 10-03-2016 at 09:44 PM.
  #2  
Old 10-03-2016, 11:35 PM
Rooftop Post's Avatar
Rooftop Post Rooftop Post is offline
Junior Member
 
Join Date: Oct 2012
Posts: 2
Default

It's okay - I've found the solution in an old thread, here: https://www.ecwid.com/forums/showthread.php?t=17299

In case anyone else has the same problem, the first solution (Maya's) worked for me. I'm using the Ecwid Wordpress plugin, so I simply logged into my wordpress dashboard, located the Ecwid "store" page (under "Pages" on the left of the wordpress dashboard/admin area), switched to the "text" view (obviously!) and pasted in Maya's code under the Ecwid widgets.

It's worth mentioning that the first time I tried, it didn't work because I hadn't got the jQuery library installed. I fixed this by following the instructions here: https://www.ecwid.com/forums/showthread.php?t=11106#5 (Thanks again to Maya - who is extremely good at explaining things simply!)

The only thing I haven't managed to do is figure out how to limit the characters in the "Text Area" boxes - Maya's code only limits characters in the "Text Field" boxes. I expect there's a really simple answer to this... but I'm afraid I don't know it as I'm not great with computers... just learning what I can as I go.

Hope this helps someone like me!
The Following User Says Thank You to Rooftop Post For This Useful Post:
smartMart (10-05-2016)
  #3  
Old 10-24-2016, 09:23 AM
Irene S's Avatar
Irene S Irene S is offline
 
Join Date: Apr 2016
Posts: 52
Default

Hi,

This is Irene from Ecwid Customer Care Team. Thank you for posing this solution here - it may be very helpful for other Ecwid users!

As for this request in your message:

Quote:
The only thing I haven't managed to do is figure out how to limit the characters in the "Text Area" boxes - Maya's code only limits characters in the "Text Field" boxes. I expect there's a really simple answer to this... but I'm afraid I don't know it as I'm not great with computers... just learning what I can as I go.
I modified Maya's code a little. Please try this script to limit the number of characters in the "Text area" boxes for all product pages:

Code:
<script type="text/javascript">
Ecwid.OnPageLoaded.add(function(page){
  if (page.type == "PRODUCT") {  
     $("input.ecwid-productBrowser-details-optionTextArea").attr('maxlength','6');
  };
})
</script>
... and this one should be used for the particular product page:

Code:
<script type="text/javascript">
Ecwid.OnPageLoaded.add(function(page){
  if ((page.type == "PRODUCT") && (page.productId == "11111")) {  
     $("input.ecwid-productBrowser-details-optionTextArea").attr('maxlength','6');
  };
})
</script>
As before, you should change "11111" to the product ID. Also feel free to adjust the limit of characters changing '6' in this line .attr('maxlength','6') to any other number.

I hope it will help you! Let us know if any further questions appear.
 
The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.

Tags
characters, field, form, limit, max

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:44 PM.
Powered by vBulletin® Version 3.8.11. Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.