• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to hide the parameters shown in the url while submitting a form

 
vanlalhmangaiha khiangte
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a form and have some values in the form ..



When the form is submitted in the address bar all these parameters are shown.Is there anyway to hide these parameters?

Thanks
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should use POST instead of GET, and make those parameters hidden input fields.
 
vanlalhmangaiha khiangte
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
My form is already using POST..
I cannot hide the parameter.. I have a common js script. Lots of pages are using this common script
In that I am doing this function..
CODE]
window.location=url;

[/CODE]
where url="welcome.do?"...ETC parameters following here

Thanks,
 
Usman Saeed
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
you can use HIDDEN input tag.
e.g
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Setting window.location is different from calling form.submit(). The former will always do a GET, while the latter -which is what the code you posted is doing- will use whatever the form's action attribute is set to.

The only way to keep parameters out of the URL is to use POST. So if that's the paramount requirement, then you'll need to adapt the code that's forcing you to do a GET.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic