Home › Toolset Professional Support › [Resolved] Min and max characters/words
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Kolkata (GMT+05:30)
Tagged: Content-submission forms, Toolset Forms
Related documentation:
This topic contains 24 replies, has 2 voices.
Last updated by Nicholas 7 years, 4 months ago.
Assisted by: Minesh.
Hello I would like to set a min and max character or word count for all CRED multiple lines text fields.
For example min of 50 words and max of 200 words.
Is this currently possible?
Hello. Thank you for contacting the Toolset support.
There is no such native feature available to set min and max character or works but you can use custom javascript/jQuery code to achieve your goal.
Please refer to the following ticket where I shared kind of solution:
=> https://toolset.com/forums/topic/limit-characters-in-multiple-custom-fields-in-a-cred-form/#post-349131
Thank you. I'll check this out and will let you know how that goes.
Ok fine - thank you.
Hello I tried all of the solution nothing worked:
https://toolset.com/forums/topic/limit-character-count-om-a-cred-field/#post-289238
https://toolset.com/forums/topic/limit-character-in-custom-field/
https://toolset.com/forums/topic/cred-form-field-character-limit-validation/
Do you mind taking a look on my site?
Regards,
Nicholas
Yes - sure.
1)
Could you please share problem URL.
2)
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
Could you please share the link of the page where you added CRED form Create Product
Well - wp-admin access details you send to me is not working at this end.
Could you please resend it to me.
No - its still not working. Could you please check that username and password are same.
I have set the next reply to private which means only you and I have access to it.
Could you please check now. CRED form element classes has been changed with new release and I've adjusted the code as given under and its working.
Please clear your browser cache before you make a test.
(function($) { $.fn.extend( { limiter: function(limit, field) { field = field.replace('wpcf-',''); $("div.form-group p.counter-"+field).hide(); $(this).on("keyup focus", function() { $("div.form-group p.counter-"+field).show(); setCount(this, field); }); $(this).on("blur", function() { $("div.form-group p.counter-"+field).hide(); }); function setCount(src,field) { var chars = src.value.length; //console.log(src); if (chars > limit) { src.value = src.value.substr(0, limit); chars = limit; } remainder = limit - chars; field = field.replace('wpcf-',''); $("div.form-group p.counter-"+field+" span.remainder").html(remainder); } setCount($(this)[0], field); } }); })(jQuery); jQuery(document).ready(function($){ jQuery(document).on( 'cred_form_ready', function() { $("input[name='wpcf-artist-1']").limiter(10, 'wpcf-artist-1'); }); });
Hello thank you. What classes were changed with the update?
Unfortunately it doesn't work.
I can still add more than 10 characters to the wpcf-artist-1 field
Well - you can compare the current solution and the old solution here:
=> https://toolset.com/forums/topic/limit-characters-in-multiple-custom-fields-in-a-cred-form/#post-349131
Thanks why doesn't the new solution work then you visit hidden link
What you mean - go to the URL: hidden link
Try to add something to Artist 1 field and number count will be display.
Hello.
It works, however when I refresh the page or leave the page and then go back it stops working. I have to clear the cookies in order to have it work again. This is very strange. This happens to all of my custom jQuery code in CRED.
It works fine inside of CT and Views, even after I refresh the page.