Skip Navigation

[Resolved] Is it possible to disable a Taxonomy cred-field in Custom Edit-Post Form?

This support ticket is created 2 years, 3 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
- 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)

This topic contains 2 replies, has 2 voices.

Last updated by Alex Russell 2 years, 3 months ago.

Assisted by: Minesh.

Author
Posts
#2431453

Tell us what you are trying to do?

I have two custom data types: Organizations and Member Profiles. Members are linked to a parent Organization by a one-to-many relationship. (one Org->many embers)

There is a taxonomy called "Member Type" attached to both Orgs and Members.

In the Add Member / Edit Member forms, I added the Member Type taxonomy as a form field, and set the value to match the parent Org's. I do not want the user to be able to change this, but I do need the data in the form, so new members created will always have the same Member Type as their parent Org.

This almost does what I need:
[cred_field field='member-types' force_type='taxonomy' output='bootstrap' display='select' single_select='true' value='[wpv-post-taxonomy type="member-types" item="@organization-member-profile.parent"]' ]

It displays the available Member Types and assigns the correct value. Except I want this field displayed but non-changeable. I tried adding a readonly='true' but I see in the documentation that does not work for select fields.

Is there any documentation that you are following?
https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_field

What is the link to your site?
hidden link

#2431673

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

What if you add a custom JS code to your form's JS editor box and add the code that should make the select box readonly.

Please check the following link that may help you:
- https://stackoverflow.com/questions/8100351/how-to-make-a-dropdown-readonly-using-jquery

#2434623

Thank you for the reply. I suspected that'd be the only way to do it. Also, TIL that a <select> can't have a readonly attribute. I ended up using checkboxes instead and using a jQ onclick function. The link you sent was very helpful. Thank you and the entire toolset support team for always being so responsive and constructive!

My issue is resolved now. Thank you!