[英]How can I make reCaptcha required in this form?
我怎樣才能做到這一點?
HTML表單代碼:
<div id="myDIV" style="">
<form name="login">
<h2 style="position:relative;right:107;bottom:10">Sign in</h2><p style="position:relative;right:55;bottom:5">to NASP Stacks database</p>
<input class="input" name="id" type="text" placeholder="Username"><br><br>
<input name="pass" type="password" class="input" placeholder="Password"><br><br>
<script>
{
"success": true|false,
"challenge_ts": timestamp, // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)
"hostname": string, // the hostname of the site where the reCAPTCHA was solved
"error-codes": [...] // optional
}
</script>
<div class="g-recaptcha" data-sitekey="6LdHRDgUAAAAAFg8efAOvTVM_9crHq_UQm_aveaW"></div><br>
<b><input class="button" type="button" value="NEXT" onClick="pasuser(this.form)"></b>
</form>
</div>
如何將reCaptcha設置為此表格的必填字段? 我已經嘗試過其他帖子,但是它們不起作用。 我之前添加了很多東西,但是它們沒有用,並且阻塞了代碼。 有人知道如何使它成為必需嗎?
只需在輸入中添加required
即可:
<input class="button" type="button" value="NEXT" onClick="pasuser(this.form)" required>
注意:我無法理解您的腳本代碼:/
您是否看到過此相關文章? reCaptcha字段為必填項
我相信您將需要有一個Javascript回調函數來驗證Recaptcha的響應,然后再繼續。 由於您的表單沒有提交輸入,因此我想您需要在onClick事件的回調函數中進行驗證。
onClick="pasuser(this.form)"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.