我想在注册用户之前向用户提供条款和条件模式。
刀片
<form method="POST" autocomplete="signupForm-noFill" action={{url("/register")}}>
{{ csrf_field() }}
<div class="form-group text-center signupForm">
<input type="email" name="email" class="form-control text-center loginForm" id="signup-email" autocomplete="no-Thanks" placeholder="Email Address">
</div>
<div class="form-group text-center signupForm">
<input type="password" name="password" class="form-control text-center loginForm" id="signup-password" autocomplete="please-No" placeholder="Password">
</div>
<div class="form-group text-center" style="display:inline-block; margin-bottom:20px;">
{!! Recaptcha::render() !!}
</div>
<div class="form-group text-center" style="">
<button type="submit" id="registerButton" role="button" class="btn btn-hp-modal btn-signup">Sign up</button>
</div>
</form>
的JavaScript
$('#registerButton').click(function() {
$("#legalModal").modal("show");
return false;
});
$('#acceptTerms').click(function() {
// Submit form data to {{url("/register")}}
return false;
});
模态按钮
<button type="submit" id="acceptTerms" class="btn btn-hp-modal underline btn-signup-modal">I Accept</button>
问题在于我不知道如何返回表单的action
并提交其数据。
我尝试将变量传递给JavaScript
函数,但似乎无法将其提交给实际的controller
。
修改
<button type="submit" id="acceptTerms" class="btn btn-hp-modal underline btn-signup-modal">I Accept</button>
答案 0 :(得分:1)
您只需要使用js
提交表单<强>刀片:强>
$('#registerButton').click(function() {
$("#legalModal").modal("show");
return false;
});
$('#acceptTerms').click(function() {
$('#my_form').submit();
});
<强> JS:强>
{{1}}