Remove “_submit=Search” url parameter

3 years ago

tpr
Member | 55
+
0
-

When I set a form to have GET method, after submit the url also contains the submit button's label – which I would like to avoid, if possible.

site.com/search/?q=helloworld&_submit=Search

Is there's a way to disable it? I'm using Nette Forms as a standalone version (latest).

(as a last resort I can remove it using JavaScript)

Last edited by tpr (2016-01-30 17:52)

3 years ago

CZechBoY
Member | 3296
+
0
-

You can use route with default parameter _submit=search.

3 years ago

tpr
Member | 55
+
0
-

I'm afraid I can't do that because I use Forms as standalone in another system.

3 years ago

CZechBoY
Member | 3296
+
+1
-

No, there is no official way to remove this because then you dont know which button submitted the form.

3 years ago

tpr
Member | 55
+
0
-

Thanks, that makes sense. Unfortunately I need the GET method because it's a search form. I'll go the JS way, no biggie.

3 years ago

Šaman
Member | 2282
+
+1
-

You can work with search form same way as every other form – in onSuccess do redirect.

3 years ago

tpr
Member | 55
+
0
-

Thanks Šaman, it works fine now. Could have thought of it myself earlier :)