MODX Community

SimpleSearch submit button not working

Hi all,

I am using SimpleSearch as a site search form. There is the following chunk in my header:

<form class="simplesearch-search-form simple-search grid-x align-middle" action="[[~[[+landing]]]]" method="[[+method]]">
  <input class="simple-search__input simple-search__search-field cell auto" type="text" name="[[+searchIndex]]" id="[[+searchIndex]]" placeholder="Search..." value="[[+searchValue]]" />
  <input type="hidden" name="id" value="[[+landing]]" />
  <button class="simple-search__submit simple-search__input cell shrink" type="submit" form="form1" value="Submit">
    <i class="icon icon-search"></i>
  </button>
</form>

The form works as expected if you enter a value and hit enter. However, nothing happens if you click the submit button element. I have tried changing this to too with no results.

Would anyone know why this is occurring or know of a fix?

Good day to you @meltingdog.

For the sake of experimentation, could you try replacing the button with something like the following?

<input type="submit" value="Submit">

Hmm yep that seemed to work!

@meltingdog, I think I figured out why your original “HTML5” code didn’t work!

The form="form1" attribute on your button tag is referencing an ID that does not exist on your form. Try adding this attribute id="form1" to your form tag. I bet that does the trick!

1 Like