Input field
1. Add the HTML form
Ensure your HTML form includes the surface-form-handler class. This class is essential for identifying the form as one that triggers the Surface Form popup. Example:
<form class="surface-form-handler">
<input type="email" placeholder="Enter your email" required />
<button type="submit">Submit</button>
</form>
2. Surface form constructor
Go to the public/index.html file in your React.js project and add the following code at the end of <body> tag:
Add the data-question-id attribute to your Surface form script.
<!-- Start Surface Form Embed -->
<script data-question-id="<question_id>">
(function () {
const surface_src = "surface_form_url";
const surface_embed_type = "slideover"; // works on all embedding types!
const target_element_class = "surface-form-button";
const c = new SurfaceEmbed(
surface_src,
surface_embed_type,
target_element_class,
);
})();
</script>
<!-- End Surface Form Embed -->