我是一名學生,我正在為博客文章練習應用程式。在startbootstrap網站上下載了“clean-blog”模板。
附上鏈接:https : //startbootstrap.com/theme/clean-blog
現在使用 Node & EJS 嘗試處理表單提交。但是表格沒有通過。有一個評論片段說:需要激活令牌
當我的滑鼠靠近提交按鈕時,我什至沒有將滑鼠指標更改為“單擊手指”。我是一名學生,只是將其用于學習目的。嘗試洗掉所有不需要的屬性,但表單仍未被激活。現在我已經撤消了對頁面所做的更改。下面是我的 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>
'''
uj5u.com熱心網友回復:
我剛剛洗掉了按鈕標簽的css 屬性,它開始作業了......!現在我的表格作業得很好。!
<button id="submitButton" type="submit">Send</button>
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/402439.html
標籤:
上一篇:單擊提交后如何清除輸入表單
