Skip Navigation

[Resolved] Help displaying custom field content

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue is that the user wanted to set some of their fields to readonly in Toolset Forms.

Solution:

What you can do is to assign a class to the shortcodes called readonly. Then use the JQuery below to disable the fields.

jQuery('.readonly').prop('readonly', true);
This support ticket is created 6 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
- 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 10 replies, has 2 voices.

Last updated by frankS-8 6 years, 3 months ago.

Assisted by: Shane.

Author
Posts
#1093871

Tell us what you are trying to do?
I am trying to display content within my code excerpt below.
I can see how the calls are made to present fields that are editable by the user, but what if I wanted to only display but not allow editing of other fields that are custom fields on the user. For example, if you look at this:
[cred_field field='maryland-license-password' post='user' value='' urlparam='' class='form-control' output='bootstrap']
You can see that this presents an editable field for the user, but what if I just wanted to display the value stored already for maryland-license-password?

Is there any documentation that you are following?
I cannot find a syntax list for Toolset Types that would give me the code for basic functionality. Please advise if there is one that could aid me.

Is there a similar example that we can see?
You can see my creduserform code below.
[creduserform class='cred-user-form cred-keep-original']

[cred_field field='form_messages' value='' class='alert alert-warning']
<br>
<bold>Change LicenseTraxx Password:</bold>
<div class="form-group">
<label>Password</label>
[cred_field field='user_pass' post='user' value='' urlparam='' class='form-control' output='bootstrap']
</div>

<div class="form-group">
<label>Repeat Password</label>
[cred_field field='user_pass2' post='user' value='' urlparam='' class='form-control' output='bootstrap']
</div>
<br>
<bold>Jurisdictions:</bold>
<div class="form-group">
<label>Maryland License Password</label>
[cred_field field='maryland-license-password' post='user' value='' urlparam='' class='form-control' output='bootstrap']
</div>

<div class="form-group">
<label>DC License Username</label>
[cred_field field='dc-license-username' post='user' value='' urlparam='' class='form-control' output='bootstrap']
</div>

<div class="form-group">
<label>DC License Password</label>
[cred_field field='dc-license-password' post='user' value='' urlparam='' class='form-control' output='bootstrap']
</div>
<br>
<bold>Your Name:</bold>
<div class="form-group">
<label>Last Name</label>
[cred_field field='last_name' post='user' value='' urlparam='' class='form-control' output='bootstrap']
</div>

<div class="form-group">
<label>First Name</label>
[cred_field field='first_name' post='user' value='' urlparam='' class='form-control' output='bootstrap']
</div>

[cred_field field='form_submit' value='Submit' urlparam='' class='btn btn-primary btn-lg' output='bootstrap']

[/creduserform]

What is the link to your site?
licensetraxx.com but what is discussed here is not publicly viewable at this time.

#1094027

Shane
Supporter

Languages: English (English )

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

Hi Frank,

Thank you for contacting our support forum.

What you can do is to assign a class to the shortcodes called readonly. Then use the JQuery below to disable the fields.

jQuery('.readonly').prop('readonly', true);

Please try this and let me know if this helps.
Thanks,
Shane

#1094104

Can you elaborate a little more on these instructions? Maybe an example of:
1. assign a class to the shortcodes called read-only
2. Then use the JQuery below to disable the fields.
using one of the fields in my example?

From there I can duplicate your syntax, method. Thank you!

#1094123

Shane
Supporter

Languages: English (English )

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

Hi Frank,

Sure no problem.

Here is an example

[cred_field field='dc-license-username' post='user' value='' urlparam='' class='form-control readonly' output='bootstrap']

Then in the JS editor of the form just add this.

jQuery('.readonly').prop('readonly', true);

Please let me know if this works for you.
Thanks,
Shane

#1095009

I added this into the JS Editor section:
jQuery('.readonly').prop('readonly', true);
which when saved appears now like:
jQuery(\'.readonly\').prop(\'readonly\', true);

I added this into the Content:

<div class="form-group">
<label>Organization</label>
[cred_field field='ltx-company' post='user' value='' urlparam='' class='form-control readonly' output='bootstrap']
</div>

I tried to match the formatting of one of my earlier features of this form, the Maryland License Password, seen below:

<div class="form-group">
<label>Maryland License Password</label>
[cred_field field='maryland-license-password' post='user' value='' urlparam='' class='form-control' output='bootstrap']
</div>

The field displays when I hit preview but it still appears to be editable.

#1095073
example for toolset.PNG

Screenshot of results

#1095149

Shane
Supporter

Languages: English (English )

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

Hi Frank,

I suspect that this would happen. This is a known issue and will be fixed in our CRED release for next week. However as a workaround, could you remove the code.

Follow the instructions in the link below.
https://toolset.com/errata/quotes-in-the-extra-css-or-js-content-will-get-backslashed/

Then re-add the code.

Thanks,
Shane

#1095249

Great, this worked. I'll have to remember to repatch the next version I guess?

Also, my last question now is, how would I call and display the user's email, like I just did for the ltx-company?

Is there a nice wiki that contains this kind of information you can suggest?

Thank you for all your help Shane, it is appreciated.

#1096164

Shane
Supporter

Languages: English (English )

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

Hi Frank,

No you shouldn't need to repatch, since the next version would include the patch.

You question meaning you want to display it on the frontend ?

This link below should be able to assist you with it
https://toolset.com/documentation/customizing-sites-using-php/functions/

Thanks,
Shane

#1096181

Thank you so much, and I want to say not only has your team been very helpful, but your product has been mostly a great experience.

I have worked with Chuck Gregory and David Zohar from your contractor's list and they have been pleasant experiences as well.

Take care Shane!

Consider this support ticket fully resolved.

#1120979

Hello was this fixed in the new version? If I had previously patched my code, can I simply update as usual and everything will "just work"?