HTML 表单在提交按钮上不起作用,需要激活

HTML Form not working on submit button & needs activation

我是一名学生,我正在为博客练习应用程序 post。在 startbootstrap 网站上下载了“clean-blog”模板。

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

现在使用 Node 和 EJS 尝试处理表单提交。但是表格没有通过。有一个评论片段说:activation token needed

当我的鼠标靠近提交按钮时,我什至没有看到鼠标指针指向 'click-finger'。我是一名学生,只是将其用于学习目的。尝试删除所有不需要的属性,但表单仍然没有被激活。现在我撤消了对页面所做的更改。下面是我的 ejs 文件的代码。

任何人都可以帮我激活“表单”以进行演示吗?我应该删除什么才能发生这种情况?

'''

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

    <body>
        <!-- Navigation-->
        <%- include('layouts/navbar'); -%>
            <!-- Page Header-->
            <header class="masthead" style="background-image: url('/assets/img/contact-bg.jpg')">
                <div class="container position-relative px-4 px-lg-5">
                    <div class="row gx-4 gx-lg-5 justify-content-center">
                        <div class="col-md-10 col-lg-8 col-xl-7">
                            <div class="page-heading">
                                <h1>Create New Post</h1>
                                <span class="subheading">Have questions? I have answers.</span>
                            </div>
                        </div>
                    </div>
                </div>
            </header>
            <!-- Main Content-->
            <main class="mb-4">
                <div class="container px-4 px-lg-5">
                    <div class="row gx-4 gx-lg-5 justify-content-center">
                        <div class="col-md-10 col-lg-8 col-xl-7">
                            <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 class="my-5">
                                <!-- * * * * * * * * * * * * * * *-->
                                <!-- * * 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 class="form-floating">
                                        <input class="form-control" id="title" name="title" type="text"
                                            placeholder="Enter the title..." data-sb-validations="required" />
                                        <label for="title">Title</label>
                                        <div class="invalid-feedback" data-sb-feedback="name:required">Title is
                                            required.</div>
                                    </div>

                                    <div class="form-floating">
                                        <textarea class="form-control" id="description" style="height: 12rem"
                                            placeholder="Enter your message here..." style="height: 12rem"
                                            data-sb-validations="required"></textarea>
                                        <label for="message">Description</label>
                                        <div class="invalid-feedback" 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 class="d-none" id="submitSuccessMessage">
                                        <div class="text-center mb-3">
                                            <div class="fw-bolder">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 class="d-none" id="submitErrorMessage">
                                        <div class="text-center text-danger mb-3">Error sending message!</div>
                                    </div>
                                    <!-- Submit Button-->
                                    <button class="btn btn-primary text-uppercase disabled" id="submitButton"
                                        type="submit">Send</button>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </main>
            <!-- Footer-->
            <%- include('layouts/footer'); -%>
                <!-- Scripts-->
                <%- include('layouts/scripts'); -%>
    </body>

</html>

'''

我刚刚删除了按钮标签的 css 属性 & 它开始工作了...!现在我的 form 工作得非常好。!

<button class="btn btn-primary text-uppercase disabled" id="submitButton" type="submit">Send</button>

就我个人而言,我只是删除了提交按钮上的 class 'disabled',如下例所示,它起作用了:

错误:

<button class="btn btn-primary text-uppercase disabled" id="submitButton" type="submit">Send</button>

正确答案:

<button class="btn btn-primary text-uppercase" id="submitButton" type="submit">Send</button>