Users of my site have to input text by custom forms, with some custom fields. I need to limit the lenght of the text the user input in front end form and display (if possible) a counter with characters left. How can I do?
Thanks.
Moreno
Hi Moreno,
Thank you for getting in touch.
This is not something that is natively possible with our Toolset plugins but I was able to find a contractor who had developed a solution for this.
You can go to the link below to see this solution.
hidden link
Thanks,
Shane
Hi,
thank you for your quick answer. Where I should put the code suggested in the solution? I've tried in the form editor (expert mode) modifying the html and inserting the jquery in the JS editor, but it doesn't work. How can I do?
Thank you.
Moreno
Hi Moreno,
Can you send me a screenshot of your form in the expert mode as well as the code itself as well ?
If possible can you highlight the field that it should apply to ?
Thanks,
Shane
Hi Shane,
finally i've solved the problem searching for solution in other forum posts.
Here's the code i've put in the JS section:
jQuery(document).ready(function ($) {
$('textarea[name="wpcf-breve-nota-biografica"]').attr('maxlength',1500);
});
// Conta i caratteri inseriti
( function( $ ) {
$( document ).ready( function(){
// insert div to display char count
$('textarea[name="wpcf-breve-nota-biografica"]').after("Caratteri rimanenti: <span class='char-count'>1500</span>");
// listen for keyup and update the count
$('textarea[name="wpcf-breve-nota-biografica"]').keyup( function(){
var chars = 1500-$('textarea[name="wpcf-breve-nota-biografica"]').val().length;
$('.char-count').html( chars );
});
});
})( jQuery );
I've two other questions:
1) labels for radio custom field don't wrap. How can I do?
2) Given that Conditional display is not supported for User fields, how can display option in radio custom field based on value of previous custom radio field?
Thanks.
Moreno
Hi Moreno,
Happy you were able to resolve the issue with the javascript.
Secondly I see that you've opened this ticket below.
https://toolset.com/forums/topic/how-to-display-certain-radio-field-options-based-on-previous-radio-box-selection/
I suspect the query there is the same as this one you're asking so I recommend marking this ticket as resolved and we will handle that issue there.
Thanks,
Shane
My issue is resolved now. Thank you!