Use submit button without surrounding form

Using a Sharepoint website, the entire website’s markup is added in one big form.

Meaning that I can’t use the following solution:

Is it possible to use submit button without the form tag, using vanilla JS?

1 Like

I am having the same issue. The CMS for the site surrounds the page in a form tag and you can’t nest form tags.

Is there an API call that i can use to launch the results modal with the current search value?

This might be the answer you are looking for:

I’m facing the same problem.

Having an overlay isn’t an option for us sadly.

This post seems to be related: Using the JavaScript embed with ASP.net Forms

The post shows that the default behavior of asp.NET is prevented out of the box by Swiftype.

However, the question still remains. Since the documentation of Swiftype shows that you need to add a form element around the input and button in order to make it work, as you can read here: Customizing Swiftype Visual Styles | Swiftype Documentation

But since Sharepoint adds one big form around the entire document, then that limits your option if you’d for instance there is a action assigned tot the asp form (always by default) want two Swiftype engines on the same page.

The article states that:

ADDING A SUBMIT BUTTON TO YOUR SEARCH BOX
Who doesn’t like buttons? To add a submit button to your search input, you can wrap the input code in a form container element and add a button element. All styling of the submit button is up to you! You can find an example below.

<form>
  <input type="text" class="st-default-search-input">
  <button type="submit">Submit</button>
</form>

This seems to be a workaround: Can you nest html forms? - Stack Overflow

It basically states that you can use HTML 5 to attach a specific form to an action. Meaning that you can append a dedicated from outside the asp.net form using jQuery, and using that for the Swiftype submit.