Removing item from Query String after form submission

I have a search form which has some default text Type your search phrase here which currently gets sent as a querystring parameter - the generated URL looks like so:


However I would like to remove it from the querystring altogether.

At what point should I remove it? I mean, I can check in the controller whether the string matches, and not use it as keywords for the search, but it is still present in the URL and ideally I would like it to be removed entirely so as not to cause any confusion (plus it looks pretty bad having the default phrase in the URL!).


The semantically correct way to have a default value for a text input field is to use the the HTML5 placeholder attribute instead of setting the value attribute:

@Html.TextBoxFor(x => x.Foo, new { placeholder = "Type your search phrase here" })

In this case the default value won't be sent when the form is submitted.

And if you need to support legacy browsers you could use the jquery.placeholder plugin which will unobtrusively enable support for it.

Need Your Help

New Relic + Wordpress - ignore wp-cron.php

php wordpress newrelic

We have installed New Relic on our server, to monitor the performance of our websites. But recently we want to remove wp-cron.php from New Relic monitoring.

Haskell — How to split a number into a list for further processing?

haskell numbers split

I have an Int that i want to split into it's individual numbers which ideally would be contained in a list, which i can then process further. So i would like something like this: