Form not submitting all attribute values

CasperLarsen
Tourist
4 0 0

Hello, i have a very simple problem but i can not for the life of me figure out what is wrong.

To keep it short. I have a GET form with checkboxes. When i check one off and press submit, it only submits the name="xx" but not the value="xxx", but this only occurs when "name=" and "value=" has different strings. Below is my code.

 

<div class='personlig-soegning-container'>
  <div class='personlig-soegning-tekst'>
    <h1>Find gulv</h1>
    <h3>Vælg gulv og klik næste.</h3>
  </div>
  <form action="{{ routes.search_url }}" method="get">
    <div class="personlig-soegning-praeferencer">
      <div class="personlig-soegning-checkbox">
        <label for="checkGulve">Gulve</label>
        <input type="checkbox" id="checkGulve" name="q" value="gulve">
      </div>
      <div class="personlig-soegning-checkbox">
        <label for="checkGulve">Skyline</label>
        <input type="checkbox" id="checkGulve" name="q" value="skyline">
      </div>
      <div class="personlig-soegning-checkbox">
        <label for="checkHello">Hello</label>
        <input type="checkbox" id="checkHello" name="hello" value="hello">
      </div>
    </div>
      <input class="btn" type="submit" value="Næste">
  </form>
</div>

 

In the example, if i check off "gulve" and submits, the value i get in the URL is "q=" (notice "name=" and "value=" are different).

However, if i check off "hello" and submits, the value i get in the URL is the correct one; "hello=hello" (notice "name=" and "value=" has identical string).

I need the "name=" to be name="q" on all the inputs. Anybody know what i am doing wrong??

0 Likes