Two forms on a single page with capcha, html5 form validation is not working anymore

人走茶凉 提交于 2019-12-13 02:57:35

问题


I am currently using two forms on a single page with a generated function to submit the invisible recaptcha with its token.

One of the problems is that the html5 form validation is not working anymore, it ignores the "required" tags on the input fields.

#sFormId# holds the form ID of the current form in an array.

<button id="#sFormId#submit-button" class="button small expand g-recaptcha" data-sitekey="xyz" data-callback="Submit#sFormId#" value="">submit</button>
function Submit#sFormId#(token){
  document.getElementById("#sFormId#").submit();
}

Another problem i am having is that the two forms are in seperate divs that toggle each other. The captcha badge is visible if the first form is open but once i toggle the other div to open the badge disappears with the first badge.

来源:https://stackoverflow.com/questions/50481891/two-forms-on-a-single-page-with-capcha-html5-form-validation-is-not-working-any

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!