Submitting Form With Bootstrap Modal Question |
When I submit my form on my bootstrap modal, if any errors found I would like to be able to add class and stop it from closing if any errors found
What is the best solution Script PHP Code: <script type="text/javascript"> Controller Delete Function PHP Code: public function delete() { View PHP Code: <?php echo $header;?>
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
Unless you have some JavaScript to override and prevent the default behavior of the submit button, submitting the form results in a new page being loaded by the browser, even if it happens to be the same page. You can check for validation errors and show the modal again when the page loads.
If you are preventing the default behavior and submitting the form via AJAX, then you would just have to send back some indication that validation failed and check for that in the JavaScript code which is run to process the response. If the response indicates there were no validation errors, you close the modal, otherwise, you display the errors.
(09-30-2015, 08:04 AM)mwhitney Wrote: Unless you have some JavaScript to override and prevent the default behavior of the submit button, submitting the form results in a new page being loaded by the browser, even if it happens to be the same page. You can check for validation errors and show the modal again when the page loads. Do you have any examples? Or links
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
Opening a bootstrap modal on page load: http://stackoverflow.com/questions/10233...-page-load
jQuery AJAX forum submission with Bootstrap modal: https://gist.github.com/havvg/3226804 CodeIgniter AJAX modal form validation and submit: http://stackoverflow.com/questions/21465...and-submit http://lmgtfy.com/?q=bootstrap+modal+for...odeigniter |
Welcome Guest, Not a member yet? Register Sign In |