Skip Navigation

[Resolved] Getting URL parameter as default value in custom search

This support ticket is created 5 years, 6 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 – 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: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by Luo Yang 5 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#1322657

Dear Sir/Madam,

I make my own custom search as below

custom search

[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div id="filter-controls">
<div class="col-xs-12 col-md-4">
  	<div class="form-group">
    	[wpv-control-postmeta field="wpcf-district" type="select" source="custom" url_param="wpv-wpcf-district" values="[wpv-view name="options-district-key"]" display_values="[wpv-view name="options-district"]"  default_label="Please select District"]
	</div>    
  </div>
  <div class="col-xs-12 col-md-4">
  	<div class="form-group">
		[wpv-control-postmeta field="wpcf-estate" type="select" source="custom" url_param="wpv-wpcf-estate" values="[wpv-view name="options-estate-key"]" display_values="[wpv-view name="options-estate"]" default_label="Please select Estate"]
	</div>
</div>
  <div class="col-xs-12 col-md-4">
    <div class="form-group">
	[wpv-filter-submit name="搜尋" output="bootstrap" class="custom-search-btn"]
	</div>
  </div>

</div>
</div>[/wpv-filter-controls]

[wpv-filter-end]

The above custom search will be called by

[wpv-form-view name="custom-search" target_id="597"]

I got the search result but I cannot pass the url parameter to this custom search fields, how can I do that?

Best regards,

Kelvin.

#1322833

Dear Kelvin,

You can get the URL with parameters simply, like this:
Goto the front-end page, in the custom search form, choose an option in search fields, click submit button, you will be able to see the URL of your browser is changed, the parameters are in that URL, you can use them directly, for example:
hidden link

#1322851

Dear Luo Yang,

I separate the search form and result in two pages, the result page includes the form also, when I select the option from the search form and press submit, I find the options do pass to the URL but the cannot correctly keep the option value to the form in result page, I find it is caused by my other ticket,
https://toolset.com/forums/topic/trim-out-all-the-space-from-the-first-and-last-options-in-custom-search/

If you can, please help to follow up the ticket also.

Best regards,

Kelvin.

#1322883

Please share your website credentials and the problem URLs in below private message box, thanks

#1322905

Thanks for the details, I think you are passing wrong URL parameters:
You should pass URL parameter values in English, same as your HTML options value, for example:
hidden link

You can get those values by this:
hidden link

choose some options in the search form, click search button

#1322979
Screenshot 2019-08-23 at 7.53.10 PM.png
Screenshot 2019-08-23 at 7.49.49 PM.png
Screenshot 2019-08-23 at 7.46.16 PM.png

Dear Luo Yang,

Please visit hidden link, from the inspector, you can find the first and last options contain a lot of space, when you select the first option 利豐大廈, although the result can be queried on the result page, you should find the first option is not selected in the selection field. The URL of the search is

<em><u>hidden link</u></em>

The parameter wpv-wpcf-estate contains the space.

If you select the 地區 as 南丫島 and search, you can still find the 南丫島 keeping in the field.

This is the result caused by the View rendering, will you follow up the ticket https://toolset.com/forums/topic/trim-out-all-the-space-from-the-first-and-last-options-in-custom-search/ ?

Best regards,

Kelvin.

#1323999