Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8853531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:40:38+00:00 2026-06-14T13:40:38+00:00

I have a form that POSTs to a 3rd-party service for validation and information

  • 0

I have a form that POSTs to a 3rd-party service for validation and information capture. In the 3rd-party back end, you can specify a URL for errors, and one option is “referring URL”.

That’s seemingly perfect. User POSTs an invalid form, and the page they are on “reloads” (not really, but that’s the impression) with error messages taken from a query string that looks like this:

http://somesite.com/?errorMessages=some%20message~~~some%20other%20message~~~etc

I parse out the separate error messages and push them into a DIV that advises the user what has gone wrong. So far so good.

However, the user continues to screw up the form, and when they POST again, the referrer is now the entire URL including the error messages. The server replies with the original error messages (it’s the referrer, after all!) as well as any remaining issues:

http://somesite.com/?errorMessages=some%20message~~~some%20other%20message~~~etc&errorMessages=new%20message~~~another%20new%20message~~~etc

You can see the issue(s), but to be clear:

  1. The form is long enough to begin with; these unchecked appends eventually cause the query string to exceed browser limitations and you get errors.
  2. The parse algorithm isn’t reporting back only the latest problems. It’s still reporting the original problems, too.

phew

That’s a long backstory for a simple question:

In the submit event, is there a way to clear the query string from the referring URL using JavaScript? I don’t want to do any referrer spoofing or avoid any legitimate security concerns, I just want to be able to send the “true” referring page minus the query string.

I’m already using jQuery, so any answers are free to use it as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:40:39+00:00Added an answer on June 14, 2026 at 1:40 pm

    Here is one way to do it:

    1. A post to a 3rd party site goes with a referer http://myapp.com/mypage.
    2. The 3rd party site redirects to http://myapp.com/mypage?errorMessages=Invalid
    3. In your HTTP request handler (whatever it is) on the server side you put the errorMessages to your session (on server side) and do a redirect to http://myapp.com/mypage.
    4. While rendering the page you use errorMessages from the session (clearing them if neccessary). I believe these are called flash session variables.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe I'm missing something but when I have a form that posts back to
I have a form that POSTs information to one of my handlers. My handler
I have a form that posts to a url which triggers file download. The
I have a form that when submited posts to remote url using curl the
I have an HTML form that posts values to a web service that sends
I have got a form that posts values to a page in a wizard.
I have a html form that posts to a new page on submit. If
I have a simple form that looks like so <% remote_form_for post, :url =>
I have a form that posts to a page. I want to display an
I have a html form that posts to a python script test.py. If someone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.