Skip Navigation

[Resolved] Add url parameter on views submit using php

This support ticket is created 2 years, 3 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 7 replies, has 2 voices.

Last updated by Shane 2 years, 3 months ago.

Assigned support staff: Shane.

Author
Posts
#1735665

Hello i have a view (you can look at here: hidden link)
My view is not using ajax (because i would like to use amp in a while)

I would like redirect to a row when visitors click on submit button, so i basically want to add "&#myrow" to parameter url when they click on.

I opened a while ago same ticket (https://toolset.com/forums/topic/add-url-parameter-on-views-submit/#post-1672009), greatly resolved from Christian Cox but using javascript.

If possibile i prefer to use php, but i can't find correct hook to use on views search submit to manipulate my url address.

Thanks!

#1736135

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for getting in touch.

Given that we don't have a hook to actually do this then you will need to use Javascript to add the url parameter after the view search has been submitted.

If we had a hook that allowed for the view url query modification then it would be possible.

Thanks,
Shane

#1736915

Ok Shane and thanks for your reply, could be a feature request?

#1737593

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

I can try to put in the request but I can guarantee that this one will be a low priority feature as users don't normally pass custom URL Parameters in views.

However I thought of an Idea, perhaps you can create and empty input tag with HTML line

<input type="text" id="fname" name="fname" value="my-value">

Given that the search are is essentially a form, it may add the fname parameter to the URL.

Thanks,
Shane

#1738493

Hello Shane using "empty input tag with HTML line" i can add fname to url, but how can i use it to redirect to anchor link on views submitting?

#1739513

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

I'm not sure what you mean by redirect to anchor link on views ? Is it that you want the view to scroll to a point ? Can you provide a little more details for me and perhaps an example ?

Thanks,
Shane

#1739765

Hello Shane, yes i want the view to scroll to a point set from a anchor link. A example:

1. the user go to website: hidden link
2. the user click on views search button
3. url address url would be for example: "hidden link"

In this way the user would redirected to top part of the page and should to scroll up to search results. So i'd rather the link was
"hidden link"

So basically i would to append "&#italian-language-course-search-result" to url address when user submit a search.

If possible i would to use php to do this.

Also your idea could be good for me (create and empty input tag with HTML line) but i can't find a way to use it for my needs.

Thanks

#1739873

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

I did a quick search for this.

You should be able to find some help with this in the link below.
https://stackoverflow.com/questions/35090139/using-a-parameter-in-url-to-scroll-to-div-mimicking-an-anchor-behavior/35092690

This should provide exactly what you need to get this working.

Thanks,
Shane