Loading...
 
Features / Usability

Features / Usability


CustomSearch landing url pre-filled with search criteria

posts: 8633 Israel

I have already used the tracker filtering URL parameter successfully like:

tiki-index.php?page=payments-list&default[tracker_field_paymentsMonthPaid]=January

(The month is even inserted from a calculation to insert the current month... neat (!)

This is on a Tiki22 with a dropdown filter (select)


I’m trying to set a bit of the same on another Tiki22 but with radio buttons.

Copy to clipboard
{input _filter="content" type="radio" _field="tracker_field_biensAC3TypeDOffre" _value="vente" _group="20"} {input _filter="content" type="radio" _field="tracker_field_biensAC3TypeDOffre" _value="location" _group="20"}


So I have 2 URL:

tiki-index.php?page=biens&default[tracker_field_biensAC3TypeDOffre]= vente
tiki-index.php?page=biens&default[tracker_field_biensAC3TypeDOffre]=location

Tried also

biens?default~tracker_field_biensAC3TypeDOffre=vente
biens?default~tracker_field_biensAC3TypeDOffre=location


But no matter what, only the second filter (the last) is working (and applied).
I checked what happen when no radio button is selected previously it ends with the second filter.

Any ideas on how to do this ?

Screen Shot 2021 02 25 At 12.17.00

posts: 126886 United Kingdom

Hi Bernard

Quite a few field types don't work, user selector and date ranges i know about, wouldn't be surprised if radio buttons were also not "supported".

However, there is a way round this, you can use the URI fragment on almost all field types. Enable the "Use custom search JavaScript file" on the plugin customsearchjs="1" and do the search you want. The URL should change to something like:
example.tiki/search#type=pdf (not sure what radio buttons will look like)
Note, you need to give your input an id, here it would be id="type" - you can then use that url to preset the field (hopefully?)


posts: 8633 Israel

Thank you Jonny for your help. ♥️

Based on you comment and the doc at http://doc.tiki.org/PluginCustomSearch#Radio_button_example: I modified my code and added the "customsearchjs" parameters.

Copy to clipboard
{input _filter="content" type="radio" _field="tracker_field_biensAC3TypeDOffre" _value="vente" id="type" _group="20"} {input _filter="content" type="radio" _field="tracker_field_biensAC3TypeDOffre" _value="location" id="type" _group="20"}


Then:

tiki-index.php?page=biens#type=location
tiki-index.php?page=biens#type=vente

or

biens#type=vente

It just load the page with nothing selected.
I have the feeling I’m missing something.
(not sure what radio buttons will look like) ?? What do you mean

posts: 126886 United Kingdom
Bernard Sfez / Tiki Specialist wrote:
(not sure what radio buttons will look like) ?? What do you mean


You can't have more than one element with the same id, so the radio buttons will need different ones... and i don't have any suitable tests set up or time to experiment now, sorry.



posts: 126886 United Kingdom

Hi Bernard again

As it would happen i had to fix a client's search page with radio buttons on, so i experimented with the id's and found this worked (for example)

In the form template
Copy to clipboard
articles: {input _filter="content" type="radio" _field="tracker_id" _value="11" _group="type" id="type_article"} organizations: {input _filter="content" type="radio" _field="tracker_id" _value="1" _group="type" id="type_org"} events: {input _filter="content" type="radio" _field="tracker_id" _value="6" _group="type" id="type_event"}


So the url for events would be /search#type_event=1

HTH mrgreen

posts: 8633 Israel

Ha ha ha dear Jonny great you could test this.

It appears that I tried something similar to the sample code you posted on my local with Firefox and it didn’t worked for me. But know I know what should work, thank you very much for this !

Tomorrow I will on a real server. (I’m not using elasticSearch)


posts: 8633 Israel

Tried on a real server, no joy...

In the search form:

Copy to clipboard
{input _filter="content" type="radio" _field="tracker_field_biensAC3TypeDOffre" _value="vente" _group="type" id="type_vente"} {input _filter="content" type="radio" _field="tracker_field_biensAC3TypeDOffre" _value="location" _group="type" id="type_location"}


(I looking in a single tracker to filter items: vente or location)

search#type_vente=vente


Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting