If you are using Ajax to submit forms on your website, or have a form validation script that must be confirmed as complete prior to submission, you will likely need to change the submit type for the SharpSpring native form tracking script to manual submission. This article will detail how to add a manual submission option to your native form tracking script.
SharpSpring offers Professional Services
to assist with custom coding. You must have code knowledge in order to use the information within this article.
The following user roles can add manual submission options:
Adding Manual Submission to Native Forms
Manual submission is required for native forms with submit buttons that are wrapped in a
<button> tag. To add manual submission to native forms, do the following:
- Add an ID to the native form that will be tracked.
- Create a native form in SharpSpring.
- Copy the form code and place in a text editor, such as Atom or Brackets.
- In the form's code, change
- In the form's code, add a parameter for the form ID directly after
The following is example code with
'myform' as the form ID and the endpoint value following it.
- In the form's code, add a line consisting of
__ss_noform.push(['submitType', 'manual']); before the first closing
- Add the following code to the script code on your site:
The use of
'null' in the code will work in most situations, but if something needs to happen only after the code has finished submitting the form, this parameter can instead be a callback function.
When using manual submission code, adhere to the following:
- The supplied code must be called after the script above when submitting the form.
- The final string in the supplied code must be the same string in line three of the native form script.
- The supplied code needs to be run from within your own form submission code, and should not be run on page load.
- The supplied code should be run once any validation for the form has passed, but before the form is removed from the page.
Example native form ID.
Note: The ID is an attribute of the form tag. This is needed to tell the Native Form script which form data to grab from the page.
|Example callback code to change the page.
Ready to Learn More?