Home > Software engineering >  HTML Form not working on submit button & needs activation
HTML Form not working on submit button & needs activation

Time:01-04

I am a student & i am working on practicing an app for a blog post. Downloaded "clean-blog" template on startbootstrap website.

Link attached:https://startbootstrap.com/theme/clean-blog

Now using Node & EJS trying to work on form submission. But the form is not getting passed through. There was a comment snippet which said: activation token needed

I am not even getting a change in mouse pointer to 'click-finger' when my mouse is near the submit button. I am a student & just using this for learning purpose. Tried removing all unwanted attributes, but still the the form is not getting activated. Now I have undone the changes I did to the page. Below is the code for my ejs file.

Can anyone help me activate the "form" just for demo purpose? What all should I remove for this to happen?

'''

<!DOCTYPE html>
<html lang="en">
<!-- Header-->
<%- include('layouts/header'); -%>

    <body>
        <!-- Navigation-->
        <%- include('layouts/navbar'); -%>
            <!-- Page Header-->
            <header  style="background-image: url('/assets/img/contact-bg.jpg')">
                <div >
                    <div >
                        <div >
                            <div >
                                <h1>Create New Post</h1>
                                <span >Have questions? I have answers.</span>
                            </div>
                        </div>
                    </div>
                </div>
            </header>
            <!-- Main Content-->
            <main >
                <div >
                    <div >
                        <div >
                            <p>Want to get in touch? Fill out the form below to send me a message and I will get back to
                                you as soon as possible!</p>
                            <div >
                                <!-- * * * * * * * * * * * * * * *-->
                                <!-- * * SB Forms Contact Form * *-->
                                <!-- * * * * * * * * * * * * * * *-->
                                <!-- This form is pre-integrated with SB Forms.-->
                                <!-- To make this form functional, sign up at-->
                                <!-- https://startbootstrap.com/solution/contact-forms-->
                                <!-- to get an API token!-->
                                <form action="/posts/store" method="POST" data-sb-form-api-token="API_TOKEN">
                                    <div >
                                        <input  id="title" name="title" type="text"
                                            placeholder="Enter the title..." data-sb-validations="required" />
                                        <label for="title">Title</label>
                                        <div  data-sb-feedback="name:required">Title is
                                            required.</div>
                                    </div>

                                    <div >
                                        <textarea  id="description" style="height: 12rem"
                                            placeholder="Enter your message here..." style="height: 12rem"
                                            data-sb-validations="required"></textarea>
                                        <label for="message">Description</label>
                                        <div  data-sb-feedback="message:required">A Description is
                                            required.</div>
                                    </div>
                                    <br />
                                    <!-- Submit success message-->
                                    <!---->
                                    <!-- This is what your users will see when the form-->
                                    <!-- has successfully submitted-->
                                    <div  id="submitSuccessMessage">
                                        <div >
                                            <div >Form submission successful!</div>
                                            To activate this form, sign up at
                                            <br />
                                            <a
                                                href="https://startbootstrap.com/solution/contact-forms">https://startbootstrap.com/solution/contact-forms</a>
                                        </div>
                                    </div>
                                    <!-- Submit error message-->
                                    <!---->
                                    <!-- This is what your users will see when there is-->
                                    <!-- an error submitting the form-->
                                    <div  id="submitErrorMessage">
                                        <div >Error sending message!</div>
                                    </div>
                                    <!-- Submit Button-->
                                    <button  id="submitButton"
                                        type="submit">Send</button>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </main>
            <!-- Footer-->
            <%- include('layouts/footer'); -%>
                <!-- Scripts-->
                <%- include('layouts/scripts'); -%>
    </body>

</html>

'''

CodePudding user response:

I just removed the css attribute for the button tag & it started working...! Now my form is working absolutely fine.!

<button id="submitButton" type="submit">Send</button>

  • Related