Skip Navigation

[Resolved] Limit character in custom fields input form

This support ticket is created 3 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 6 replies, has 2 voices.

Last updated by morenoT 3 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#2338931

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

#2339091

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

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

#2339555

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

#2339729

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

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

#2340627

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

#2340657

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

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

#2341153

My issue is resolved now. Thank you!