Dilip Rajkumar
Dilip Rajkumar

Reputation: 7074

Html Form Submit appends + (plus) in URL params

I am having a simple form following is the code

<form action="search.html" method="get" accept-charset="utf-8" id="search-within-form"">
    <input type="hidden" name="within" id="within" value="">
    <input type="text" name="q" value="" id="search-within" autocomplete="off" class="search-within-results inactive" title="">
    <input type="submit"/>
</form>

I am entering test data for search in the field and click submit, in the URL I see is

/search.html?within=&q=test+data+for+search

But I need the url to be like tis

/search.html?within=&q=test data for search

I know this can be done by using java script form submit etc.. I like to know is there some way I can achieve this using html?

Thanks in advance.

Upvotes: 0

Views: 1711

Answers (2)

Pi Horse
Pi Horse

Reputation: 2430

Why don't you clean the text at the place you retrieve the value from the form ? Is there any reason why you can't do that ?

Upvotes: 2

zajd
zajd

Reputation: 761

Your URL will never display that way in a browser. Either the text will be seperated by those '+' characters or it will be seperated by '%20's. Is there a reason you need the URL to display in that fashion? Ultimately it comes down to how the browser displays the URL in the address bar. '%20' is code for a space. You might be able to develop a browser extension that would make them display with the spaces, but that sounds pretty terrible to me.

Upvotes: 3

Related Questions