0

How can I prevent the URL I put in my forms and inputs from being encoded?

Code (JADE):

form(method="get" action="http://whateverdomain.com/blabla?")
    input(type="text" name="action=basic&searchstr" size="31" value)

^That spits out this:

"http://whateverdomain.com/blabla?action%3Dbasic%26searchstr=mySearchQuery"

And that doesn't work — Which is why I'm asking for help here.


Context:

I'm trying to make myself a custom 'New Tab' page with search boxes connected to the sites (forums, etc) I often use.

Thanks in advance!

2
  • action="blabla?action=basic, name="searchstr"... Commented Oct 23, 2015 at 13:21
  • Wow, I can't believe it was that simple. Thanks a lot! Commented Oct 23, 2015 at 13:29

1 Answer 1

1

When using a form with methot="get", all your form elements' names and values will be appended to the query string of the action URI for the request that is issued when you submit the form.

When building the query string, the browser will percent-encode the names of the form fields.

If you have any query string parameters that you want to hardcode in the request URI, either add them as hidden form fields:

<form action="blabla">
    <input type="hidden" name="action" value="basic" />
    ...

Or add them to the query string of the action URI:

<form action="blabla?action=basic" ...>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.