Skip to content

RyanSMurphy/Laravel-Bootstrap-Modal-Form

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

Laravel-Bootstrap-Modal-Form

A form validation extension for your Laravel app. Use when embedding a Bootstrap form into a Bootstrap/jQuery modal. This script keeps modal open, submits form via AJAX, queries your Laravel validation rules, and populates error messages.

Demo

Requirements

Quick Installation

Via Bower:

bower install jerseymilker/laravel-bootstrap-modal-form --save

Basic Usage

Additional Notes

  • Script does not handle CSRF tokens. Use Laravel's _token field in your forms if needed.
  • Script submits via POST form action. Use Laravel's method spoofing if you need to submit via PUT, PATCH, or DELETE.
  • If script detects file input, FormData object will be used (requires IE10+, more info on browser compatibility here).

Shameless Plug

I highly recommend BootForms form builder package by Adam Wathan. This is a great helper which makes generating Bootstrap form markup super easy. It even auto-detects Laravel's validation state and outputs error messages for most field types.

Example:

{!! BootForm::text('First Name', 'first_name') !!}

Generates:

<div class="form-group {!! $errors->has('first_name') ? 'has-error' : '' !!}">
  <label for="first_name">First Name</label>
  <input type="text" class="form-control" id="first_name">
  {!! $errors->first('first_name', '<p class="help-block">:message</p>') !!}
</div>

About

Bootstrap form inside modal. Submits using AJAX, uses Laravel validation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published