lundi 8 octobre 2018

Form tag is appearing as a div

I don't know how else to describe this problem. Let me show you the code:

This is my .html.erb file:

    <div class="tab-search-browse">
      <%= form_tag category_searches_path, :id => "#{prefix}-category-search-form" do %>
        <%= label_tag :category_search_terms, t(:category_keywords) %>
        <%= text_field_tag :category_search_terms %>
        <%= submit_tag t(:search_categories), :class => "button utility-button" %>
        <%= content_tag(:span, '* '+t(:enter_category_search_terms), :class => 'instruction') %>
      <% end %>
    </div>

And this is what I see when I view-source:

  <div class="tab-search-browse">
      <form accept-charset="UTF-8" action="/category_searches" id="product-category-search-form" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="pSzNhg22JRKW+qN01fACKb1UURn/BI6wjHtXyYoARvE=" /></div>
        <label for="category_search_terms">Category keywords:</label>
        <input id="category_search_terms" name="category_search_terms" type="text" />
        <input class="button utility-button" name="commit" type="submit" value="Search Categories" />
        <span class="instruction">* Enter keywords related to your item to get category suggestions</span>
      </form>        
  </div>

Looks good, right?

And yet.. what I see in the Chrome Developer Tools, under "Elements" is this:

    <div class="tab-search-browse">
      <div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="pSzNhg22JRKW+qN01fACKb1UURn/BI6wjHtXyYoARvE="></div>
        <label for="category_search_terms">Category keywords:</label>
        <input id="category_search_terms" name="category_search_terms" type="text">
        <input class="button utility-button" name="commit" type="submit" value="Search Categories">
        <span class="instruction">* Enter keywords related to your item to get category suggestions</span>
    </div>

Clicking on the submit button does nothing. So I'm inclined to agree with whatever's in the developer tools, rather than the source code. This isn't the first time I've run into this issue, and I'm very confused.

Aucun commentaire:

Enregistrer un commentaire