Skip Navigation

[Closed] Making part of a form conditional on whether a field has content

This support ticket is created 4 years, 7 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.

Our next available supporter will start replying to tickets in about 0.61 hours from now. Thank you for your understanding.

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: Africa/Casablanca (GMT+01:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Jamal 4 years, 7 months ago.

Assisted by: Jamal.

Author
Posts
#1573159

I am trying to make part of a post edit form only appear if an audio file field has an audio file in it.

I have used the following code:


[cred_show_group if="( $(wpcf-audio-13602434) eq '' )" mode="fade-slide"]


		<div class="cred-field cred-field-date-of-broadcast">
			<label class="cred-label">
              Date and EXACT time of Broadcast <h6>(there is no longer a need to convert from BST, just use whatever is "normal" time!)</h6>
          </label>
          [cred_field field='date-of-broadcast' post='audio-file' value='' urlparam='']
		</div>
[/cred_show_group]          



[cred_show_group if="( $(wpcf-audio-13602434) ne '' )" mode="fade-slide"]
		<div class="cred-field cred-field-date-of-broadcast">
			<label class="cred-label">
              Date and approximate time of Broadcast <h6>(there is no longer a need to convert from BST, just use whatever is "normal" time!)</h6>
          </label>
          [cred_field field='date-of-broadcast' post='audio-file' value='' urlparam='']
		</div>
            <label class="cred-label">
              Add your audio file
            </label>
  [cred_field field='audio-13602434' force_type='field' output='bootstrap']

          <label class="cred-label">
              Myriad Cart Number
            </label> if this audio is also in Myriad please provide the cart number
[cred_field field='cart-number' force_type='field' class='form-control' output='bootstrap']
[/cred_show_group]  	

Neither of the pieces of content in the two cred_show_group s appears.

Thanks

#1573487

Hello and thank you for contacting the Toolset support.

Your code seems correct, and it should work. To better assist with this issue, I'll need to access your website to check this further.
*** Please make a FULL BACKUP of your database and website.***
Your next reply will be private to share credentials safely.

You may also want to check if setting the condition on the post type definition will work for your form.
https://toolset.com/documentation/user-guides/front-end-forms/conditional-display-for-form-inputs/

Please give more details about the form and where it is used.

The topic ‘[Closed] Making part of a form conditional on whether a field has content’ is closed to new replies.