Home › Toolset Professional Support › [Resolved] Using jQuery to show/hide conditional custom field and its label
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 9 replies, has 2 voices.
Last updated by kelvinL-2 3 years, 6 months ago.
Assisted by: Minesh.
Dear Sir/Madam,
I have a post form with some conditional custom field, most of the fields will be showed/hide according to a dropdown field selection. I make the fields in table format, I want to hide the header also if field is conditionally hide, how can I check the value from the dropdown field using jQuery?
Refer to the screenshot, you should see two options from the dropdown, when I change the option, the custom fields will be showed or hide respectively.
Best regards,
Kelvin.
Dear Sir/Madam,
I fixed the jQuery to show/hide the custom fields including header, how can I show/hide the fields by checking the url parameter from the parent post or there is such setting to the child post form? Please advise.
Hello. Thank you for contacting the Toolset support.
There is no such native feature available that you can show/hide the content based on the URL param.
But have you try to use the [wpv-conditional] statement with [wpv-search-term] shortcode?
Using [wpv-search-term] shortcode you can grab the URL param value.
=> https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-search-term
For example: if the URL contain the pram/value as: ?color=red
[wpv-conditional if="( '[wpv-search-term param='color']' eq 'red' )"] This is red color [/wpv-conditional]
Dear Minesh,
Thanks for your reply. What I want is to set the value to the parent field
[cred_field field='@application-contestant.parent' class='form-control' output='bootstrap' select_text='--- not set ---' required='true']
I want to pass the value to form and set the value of the parent field instead of selection. How can I assign the url parameter value as the parent field value?
Best regards,
Kelvin.
what is the URL param name you are passing?
If you set your URL param as: parent_application_id with the requried parent ID you want to pass then the parent dropdown value will be automatically selected.
Dear Minesh,
I try adding the URL param parent_application_id but not work. Refer to screenshot, when I type the url as
/add-new-contentant/?parent_application_id=2565
then it will be redirected to
/add-new-contentant/?parent_application_id=2565&doing_wp_cron=1629928239.1215760707855224609375
I want to add the button with passing the parent application id, what is the url should be? I tried to type the url from browser, I don't see the parent field is auto selected. You can see my parent post with id 2565 is existed.
Here is the parent post field code
<div class="form-group"> <label for="%%FORM_ID%%_@application-contestant.parent">[cred_i18n name='@application-contestant.parent-label']Applications Contestants[/cred_i18n]</label> [cred_field field='@application-contestant.parent' class='form-control' output='bootstrap' select_text='--- not set ---' required='true'] </div>
That is strange. What is your parent post type slug?
What if you try ?parent_applications_id=2565 - does that works?
Dear Minesh,
Thanks for your reply. I checked my parent post slug is vwcm-application, after changing to parent_vwcm-application_id, it works now.
Glad to know that its working now. you are welcome to close this ticket.
My issue is resolved now. Thank you!