私はモーダルです。モーダルのヘッダーには、ログインするタイトルがあります。私はログインフォームを持っていて、フッターにはログインボタンがあります。モーダルのフッターに配置されたボタンのタスクを変更します
ログインボタンの後に、アカウントを作成したい人のためのハイパーテキストがあります。ハイパーテキストをクリックするとログインフォームが消え、登録フォームが表示されます。
ログインに同じボタンを使用する可能性はありますか? (最も単純な言葉では、2つの異なるフォームで同じボタンを使用することは可能ですか、できない場合は、ボタンをフッターに追加して繰り返しフォームの送信ボタンとして機能させるにはどうすればいいですか)
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #222">
<div class="mu-title">
<span class="mu-subtitle" id = "loginTitle">Login</span>
</div>
</div>
<!-- Body of the modal -->
<div class="modal-body" style="background-color: #222">
<form id="registerForm" method="POST" action="register.php" novalidate="novalidate" style="display: none">
<div class="form-group">
<label for="name" class="control-label" style="color: white">Full Name</label>
<input type="text" class="form-control" id="fullName" name="fullName" value="" required="" title="Please enter you full name" placeholder="Full Name">
<span class="help-block"></span>
</div>
<div class="form-group">
<label for="username" class="control-label" style="color: white">Username</label>
<input type="text" class="form-control" id="username" name="username" value="" required="" title="Please enter you username" placeholder="[email protected]">
<span class="help-block"></span>
</div>
<div class="form-group">
<label for="password" class="control-label" style="color: white">Password</label>
<input type="password" class="form-control" id="password" name="password" value="" required="" title="Please enter your password">
</div>
<div class="form-group">
<label for="matrix" class="control-label" style="color: white">Matrix Number</label>
<input type="text" class="form-control" id="matrixNO" name="matrixNO" value="" required="" title="Please enter you Matrix Number" placeholder="Matrix Number ">
<span class="help-block"></span>
</div>
</form>
<form id="loginForm" method="POST" action="login.php" novalidate="novalidate">
<div class="form-group">
<label for="username" class="control-label" style="color: white">Username</label>
<input type="text" class="form-control" id="username" name="username" value="" required="" title="Please enter you username" placeholder="[email protected]">
<span class="help-block"></span>
</div>
<div class="form-group">
<label for="password" class="control-label" style="color: white">Password</label>
<input type="password" class="form-control" id="password" name="password" value="" required="" title="Please enter your password">
</div>
</div>
<div class="modal-footer" style="background-color: #222">
<button type="submit" id ="loginButt" class="mu-readmore-btn">Login</button></br></br>
</form>
<span style="color: white" >Create an <a href= "#" style="color: white" onClick="$('#loginForm').hide();$('#registerForm').show(); " >Account</a> </span>
</div>
</div>
ですあなたは右のフォームを右のURLに投稿します – RohitS
@RohitS事は私の最初のフォームです。私のモーダルのボディの中で2番目のフォームの開始前に開始して終了してから、私はボディに2番目のフォームを開始しますが、モデルのフッターので、ログインボタンはログインでのみ動作し、登録はしません –
あなたはスクリプトでそれを行う必要があります。現在アクティブなフォームのラックをクリックし、その値を読んでください。結果に応じて適切なURLにフォームを送信してください – RohitS