Skip Navigation

[Resolved] Passing Search Value to CRED Form

This support ticket is created 6 years, 11 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 4 replies, has 3 voices.

Last updated by Minesh 6 years, 11 months ago.

Assisted by: Minesh.

Author
Posts
#527637

I have a parametric search which let's the users search using the following criteria: two taxonomies and two custom text fields. Once the user enters values for each field they click submit and are taken to a target page with the View that contains any search results. If they don't see anything come up in the search they then click on a link to Add a new listing via CRED form. What I would like help on is the following:

1. I need the taxonomy fields and text fields of the parametric search to be required.

2. I need the link to "Add a new listing" to only appear if no results are found.

3. I need the values entered/selected in the search form to auto-fill in the CRED form, so that users don't have to re-enter the information again, which current users find tedious/annoying.

Thank you in advance for your help with these items!

#527772

Dear David,

Q1) I need the taxonomy fields and text fields of the parametric search to be required.
I assume we are talking about those taxonomy fields and text fields which are outputted from Views shortcode [wpv-control]:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control
as you can see in above document, there isn't such an option to setup the fields as required, so there isn't such a built-in feature within Views plugin, if you agree, we can take it as a feature request, our developers will evaluate it

Q2) I need the link to "Add a new listing" to only appear if no results are found.
Yes, it is possible, you can wrap the link "Add a new listing" into Views shortcode [wpv-no-items-found] ... [/wpv-no-items-found], see our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-no-items-found
Content wrapped with [wpv-no-items-found][/wpv-no-items-found] will be output if there are no posts, taxonomies or users returned by the View.

Q3) I need the values entered/selected in the search form to auto-fill in the CRED form, so that users don't have to re-enter the information again, which current users find tedious/annoying.
Yes, it is possible, you can try this:
1) In the "Add a new listing" link, pass URL parameters to the target page
2) in the target page, display a CRED form
3) use Views shortcode [wpv-search-term] to get the URL parameter values, and setup it as default
value of CRED shortcode [cred_field]

More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term
This shortcode displays the search term when visiting the search results page, mainly if it is controlled using a WordPress Archive created in Views.
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
Parameters ‘value’=> [optional] Preset value

#527999

You are amazing Luo. Working on implementing now.

#528124

Luo,

Everything is working except the default values for the CRED Form Taxonomy Fields. Here is what I have in the CRED Form:

[cred_field field='vehicle-year' display="select" single_select="true" value="[wpv-search-term param='wpv-vehicle-year']"]

[cred_field field='vehicle-make' display="select" single_select="true" value="[wpv-search-term
param='wpv-vehicle-make']"]

Neither is populating automatically to include the search terms, but the text fields I have set up for the two other search terms are populating automatically properly.

I read a few posts in the forum and it looks like you cannot pass a default value to a taxonomy in WP-Types just yet. If that truly remains an impossibility is there a way to pass the search term values in a cred_before_save_data function? I would need assistance, or at the very least some guidance in doing so, if that is the only option for passing the default taxonomy values.

Thank you again Luo for all of your help so far and in advance for helping me get this last issue resolved.

#528487

Minesh
Supporter

Languages: English (English )

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

Luo is on vacation and this is Minesh here and I'll take care of this ticket and try to help you further. Hope this is OK.

Is it possible for you to share problem URL so I can check what I can do to set default taxonomy term to your taxonomy dropdown?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.