Stripping URL of Shortcut Links on Same page

By: Mark Hansen | Asked: 01/26/2023
ForumsCategory: How-toStripping URL of Shortcut Links on Same page
Mark HansenMark Hansen asked 1 year ago

Hey All - I have a form that is on  a page with shortcut links to the different sections. For example, this form shortcut is https://www.mydomain.tld/page-url/#calculator

 

When the form is submitted, I pass a few strings via API to an application, such as category and user, so the final url redirect looks like: https://www.mydomain.tld/redirect-url/&cat=33&usr=43

 

What is happening when using the shortcut links on the page, is that the shortcut is appending itself to the URL, and submissions are failing.  Ex: https://www.mydomain.tld/redirect-url/&cat=33&usr=43#calculator

 

Does anyone know how I can strip the #calculator from redirected url? I've tried to add another variable, I've tried sanitizing and using other features set in formidable, but can't seem to get it to work.

 

Thanks in advance,

 

Mark

2 Answers
Victor Font answered 1 year ago
I'm not sure how this is possible if you are building the redirect URL manually. How are you building the redirect?
Mark HansenMark Hansen answered 1 year ago
Hey Victor, thanks for jumping in. The redirect URL is built in the Formidable form settings page, On Submit > redirect to URL. The next page in the process is a second form that gathers more information about the user, before submitting it. The URL is formed like this in settings: www.mydomain.tld/step-2/?z=[2146 sanitize_url=1]&t=220&c=Formname Since the user came from a specific section of the page in which they clicked an on-page shortcut link, what is being sent is the correct URL, but with the #calculator shortcut on the end: www.mydomain.tld/step-2/?z=[2146 sanitize_url=1]&t=220&c=Formname#calculator Note: I have tried using a hidden form variable for the formname value and sanitizing the URL, but the result is the same. Thanks, Mark
Bobby Clapp replied 1 year ago

If the #calculator is acting as an anchor to the section, moving the user down the page to that section, then stripping the URL will stop that. You'll probably want to instead create some jQuery/JS logic to move you about the page depending on the actions prior.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right