PHP code example of bllim / laravel-to-jquery-validation
1. Go to this page and download the library: Download bllim/laravel-to-jquery-validation library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bllim / laravel-to-jquery-validation example snippets
$rules = ['name' => 'l' => 'foo/bar', 'method' => 'put'), $rules);
Form::text('name');
Form::text('email');
Form::text('birthdate');
Form::close(); // don't forget to close form, it reset validation rules
// in controller or route
$rules = ['name' => 'orm::open(array('url' => 'foo/bar', 'method' => 'put'), $rules);
// some form inputs
Form::close();
$rules = ['age' => 'numeric|max'];
class UserController extends Controller {
public static $createValidation = ['name' => 'tCreate()
{
Form::setValidation(static::$createValidation);
return View::make('user.create');
}
public function postCreate()
{
$inputs = Input::only(static::$createColumns);
$rules = static::$createValidation;
$validator = Validator::make($inputs, $rules);
if($validator->fails())
{
// actually withErrors is not really neccessary because we already show errors at client side for normal users
return Redirect::back()->withErrors($validator);
}
// try to create user
return Redirect::back()->with('success', 'User is created successfully');
}
}