Skip Navigation

[Resolved] I would like to remove a pesky query string from a cred form submission

This support ticket is created 5 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Adrian 5 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1318467

Hi, I have a CRED form that changes the current user on submit.
Ajax is off and it refreshes the page on submit.

Problem is that it adds some query string to the URL, and I'd like to get rid of that.
`webtemple.io/?_tt=1566115370&_success=285_1&_target=1#cred_form_285_1`

Status messages are not important for my application here.

How can I accomplish that?
Thank you

#1318591

Hi, Forms requires those URL parameters in certain circumstances so there are no options available for suppressing them. If you'd like to remove them completely, you would have to implement custom JavaScript to manipulate the URL hash after the page loads. Here's a Stack Overflow post with a couple of examples: https://stackoverflow.com/questions/22753052/remove-url-parameters-without-refreshing-page

#1318655

Thank you!
That is exactly what I was looking for!

I will just add the code from the page here, so others can find it easier:

1- To modify current URL and add / inject it (the new modified URL) as a new URL entry to history list, use pushState:

window.history.pushState({}, document.title, "/" + "my-new-url.html");

2- To replace current URL without adding it to history entries, use replaceState:

window.history.replaceState({}, document.title, "/" + "my-new-url.html");

via https://stackoverflow.com/questions/22753052/remove-url-parameters-without-refreshing-page