Submit Button in Bootstrap 3 Modal Not Working -
i want form submit same page, left form action black. i've tried using <button type="submit">
, <input type="button">
, <input type="submit">
. here live version more context. when click "add student," click "save student info" button, nothing, close button works.
here code modal.
<div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">add new student</h4> </div> <div class="modal-body"> <form class="form-horizontal" role="form" method="post" action=""> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputid" placeholder="student id number"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputlast" placeholder="last name"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputfirst" placeholder="first name"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputaddress" placeholder="street address"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputcity" placeholder="city"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputstate" placeholder="state"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputzip" placeholder="zip"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputbalance" placeholder="current balance"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputterm" placeholder="first term attended"> </div> </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> <input type="submit" value="save student information" id="submit" name="submit" class="btn btn-primary"> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->
your submit button outside of tag. make form wrap whole modal window this...
<div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <form class="form-horizontal" role="form" method="post" action=""> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">add new student</h4> </div> <div class="modal-body"> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputid" placeholder="student id number"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputlast" placeholder="last name"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputfirst" placeholder="first name"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputaddress" placeholder="street address"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputcity" placeholder="city"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputstate" placeholder="state"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputzip" placeholder="zip"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputbalance" placeholder="current balance"> </div> </div> <div class="form-group"> <div class="col-sm-offset-1 col-sm-10"> <input type="text" class="form-control" id="inputterm" placeholder="first term attended"> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> <input type="submit" value="save student information" id="submit" name="submit" class="btn btn-primary"> </div> </div><!-- /.modal-content --> </div> </div><!-- /.modal-dialog --> </div><!-- /.modal -->
Comments
Post a Comment