SimpleSearch Required Field

I’ve got a feeling this is a silly question but is there a way to make the ‘keyword’ field in SimpleSearch required? i.e. it shouldn’t be blank.

What exactly do you mean by “‘keyword’ field”?

If you mean the input field for the search value in the form, then you probably can add required to the <input>-tag in the chunk SearchForm.

Sorry, the search input field

The required attribute should ensure, that the form isn’t sent without a search value.

<form class="simplesearch-search-form" action="[[~[[+landing]]]]" method="[[+method]]">
        ...
        <input type="text" name="[[+searchIndex]]" id="[[+searchIndex]]" value="[[+searchValue]]" required />
        ...
</form>

Thank you - client is requesting it but it just seems a bit silly to me.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.