<?php // DP style $rules_delete_exception = array(); $rules_delete_exception[] = 'booker_name { required: true }'; $this->formhelper->setupJsFormValidation('confirm_form', '{'.implode(', ', $rules_delete_exception).'}', $messages='{}', $submit_handler='default'); ?> <!-- action button --> <button type="button" class="btn bg-danger" data-toggle="modal" data-target="#confirm_modal">Confirm</button> <!-- Modal to confirm action initially hidden --> <div id="confirm_modal" class="modal fade" tabindex="-1"> <?php echo form_open('controller/method', array('id' => 'confirm_form')); ?> <input type="text" name="booker_name"> <button type="button" data-dismiss="modal">Close</button> <button type="submit">Yes, delete exception</button> </div> </form> </div> <script> // Jquery style const fv = FormValidation.formValidation(confirm_form, { rules: { 'booker_name', {required: true } }, }); </script>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter