0

I have a table nested inside a form to align the input fields. The form is a Boostrap Modal class and I want to pass the values inside the input fields to entryHandler.php for processing. I'm using the method = "get" in the form so I should be able to see the input values reflected in the url. However, nothing happens when I click the submit button. As if no code ran. Is there something wrong with the structure of my code?

<div class="modal fade addEntryModal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">Add Entry</h4>
                </div>
                <div class="modal-body">
                    <div class="container col-md-offset-2 col-md-8" id="form">
                        <form action="entryHandler.php" method="get" class="form-group">
                            <table class="table center" id="recordForm">
                                <tr id="frm-code">
                                    <td>Code</td>
                                    <td>
                                        <input type="text" class="form-control" id="txt-code">
                                    </td>
                                </tr>
                                <tr id="frm-title">
                                    <td>Title</td>
                                    <td>
                                        <input type="text" class="form-control" id="txt-title">
                                    </td>
                                </tr>
                                <tr id="frm-unit">
                                    <td>Unit</td>
                                    <td>
                                        <input type="text" class="form-control" id="txt-unit">
                                    </td>
                                </tr>
                            </table>
                            <div class="modal-footer">
                                <div class="pull-right row">                       
                                    <input type="submit" id="hrefSave"  name = "entrySubmission" class="form-control pull-right" value = "Add" data-dismiss="modal">
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
Donovan Keating
  • 1,715
  • 3
  • 17
  • 27

2 Answers2

2

I don't have enough reputation to comment, so i will put an answer here. I think you are missing the "name" attribute in all of your 3 input inside your <td>.

Long Kim
  • 490
  • 3
  • 9
  • I added the name attributes but still nothing happened. Did not get redirected and received no errors. – Donovan Keating May 22 '17 at 23:22
  • @DonovanKeating Hi, i think maybe the bootstrap modal js has something to do with the submit event. You can have a look in this similar question https://stackoverflow.com/questions/16154216/twitter-bootstrap-modal-form-submit . You can put an id for your submit button and do a jquery submit instead. – Long Kim May 22 '17 at 23:31
1

Can you try removing the data-dismiss="modal" attribute on your submit button? I think it will prevent the default event and just dismiss the modal.

  • Agreed, per [Can't submit my modal form in Bootstrap](https://stackoverflow.com/questions/32155762/cant-submit-my-modal-form-in-bootstrap). – showdev May 23 '17 at 17:18