Skip Navigation

[Resolved] Limiting text input on a post form

This support ticket is created 3 years, 5 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by kellyD-3 3 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#2447669

I need to limit the characters on the custom post type form. The first field (Describe in a few words what you received.) is the custom post type title. It uses the WordPress title for a custom post type named submissions.

The field I need to limit input length on is the 3rd field (If you'd like to, you can share a little more about your experience.)
It uses a multiple lines field.

hidden link

Can you also point me to some documentation as to whether Toolset is deleting EXIF data from uploaded images? I would like it to do so.

Thank you so much for your help!
Kelly

#2447819

Hello,

There isn't such kind of built-in feature within Toolset Forms plugin, it is possible with a custom JS codes, for example, edit the post form you mentioned above, in section "JS editor", add below JS codes:

jQuery(document).on('cred_form_ready', function() {
    jQuery("textarea[name='wpcf-new-submission-story']").attr("maxlength", 10);
});

More help:
hidden link

#2448007

Thank you that code works for the third field on the form.
I also need something for the first field which is the post_title.

The first field (Describe in a few words what you received.) is the custom post type title. It uses the WordPress title for a custom post type named submissions.

I tried:
jQuery(document).on('cred_form_ready', function() {

jQuery("textfield[name='post_title']").attr("maxlength", 10);

});

But it didn't work. Can you assist with this field as well, please?

#2448197

You can modify the custom codes as below:

jQuery(document).on('cred_form_ready', function() {
    jQuery("textarea[name='wpcf-new-submission-story']").attr("maxlength", 1000);
    jQuery("input[name='post_title']").attr("maxlength", 10); 
});
#2449619

My issue is resolved now. Thank you!