Skip Navigation

[Resolved] limit characters of single line input and multiline input

This support ticket is created 6 years 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/Karachi (GMT+05:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by SteffenM1628 6 years ago.

Assisted by: Waqar.

Author
Posts
#1169751

I am trying to:
The title says it!

Hey there,
i followed this to do a character limit on fields but it does not work for me:
https://toolset.com/forums/topic/limit-character-count-om-a-cred-field/

how do i have to address the cred fields right?

#1170489

Hi Steffen,

Thank you for contacting us and I'll be happy to assist.

Can you please share temporary admin login details, so that I can log in and see the form and the custom script that you've added?

I've set your next reply as private so that only you and our support team will have access to it.

Please share the link to the page where the form and custom script can be viewed.

Important note: Please make a complete backup of the website, before sharing the access details.

regards,
Waqar

#1170504

Hey Waqar,

like you know you can´t give a cred form field an id= attribute.

So i just want to know how i can use a field in a form as an id for jquery.

Lets have this code example:
[php]
$("'HERESHOULD_BE_THE_POST-FIELD_OR_CUSTOM-FIELDS_SELECTOR").on("click", function(){
$(this).hide();
});
How can i address the formfields ID

cheers

#1171107

Hi Steffen,

Thanks for writing back.

Your understanding is correct and the "cred_field" shortcode doesn't accept an "id" attribute.
( ref: https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field )

But, there are a number of ways through which you can target a specific field through jQuery:

1. You can use the class attribute, to include a special unique class to the field, e.g.


[cred_field field="post_title" class="form-control special-field-1" output="bootstrap"]

You'll be able to select that field in a jQuery script like this:


$(".special-field-1").on("click", function(){
$(this).hide();
});

OR

2. You can also add a specific "id" to the wrapper of the field that you'd like to target, e.g.:


<div class="form-group" id="special-field-1">
	<label>Title</label>
	[cred_field field="post_title" class="form-control" output="bootstrap"]
</div>

And then target it through jQuery code like this:


$("#special-field-1 input").on("click", function(){
$(this).hide();
});

You'll find more useful information on jQuery selectors at:
hidden link

I hope this helps.

regards,
Waqar

#1172235

My issue is resolved now. Thank you!