Giter VIP home page Giter VIP logo

forma's Introduction

Forma

IN DEVELOPMENT - But feel free to have a play!

A nice way to play with forms in both Laravel 4 and PHP. Does not require Laravel to be used.

Requires PHP 5.4+

For non-Laravel usage use the following format for calls.

use Forma\Forma;

$forma = new Forma();
echo $forma->email('email')->id('inputEmail')->required();

Clever Features

  1. Auto-repopulation from Input::get() or Input::old() if value not provided
  2. Auto-labels either prepended or wrapped
  3. Checkboxes submit even if not checked (hidden input hack)
  4. Language file support for label and option text
  5. Nest tags within tags
  6. Automatic ID creation for labels and fields
  7. Chaining of methods to quickly do what you need and force it to behave a certain way
  8. Add select options manually and from arrays, great for making a 'Please select' option

Examples


Forma::populate($user);

Forma::open('user','GET')->class('glenn')->class('bob')->attr('id','sweet');

Forma::open_secure('article')->files();

Forma::text('first_name','glenn<$@£$T£!^;')->class('form-control')->attr('id','first_name');

Forma::text('last_name')->id('inputLast')->forceEmpty();

Forma::email('email')->id('inputEmail')->required();

Forma::password('password')->id('inputPassword')->allowValue();

Forma::input('color')->type('color')->id('inputColor');

Forma::checkbox('confirm',1)->checked();

Forma::open()->child(Forma::checkbox('confirm',1)->omitHidden());

Forma::label()->child(Forma::checkbox('confirm'));

Forma::checkbox('confirm')->withLabel('Please Confirm');

Forma::checkbox('confirm')->id('sweeeetID')->withLabel('Please Confirm');

Forma::input('color')->type('color')->id('inputColor')->withLabel('Pick a color');

Forma::checkbox('confirm')->id('inputConfirm')->wrap('Option One',array('class'=>'checkbox'));

Forma::hidden('secret','thing');

Forma::token();   // Laravel only

Forma::textarea('secret','thi>ng<dd')->rows(10);

Forma::radio('choice')->id('inputChoice')->wrap('Option One',array('class'=>'radio'));

Forma::file('image')->id('inputFile')->wrap('Select Image');

Forma::text('last_name')->id('inputLast')->placeholder('Enter last name');

Forma::text('last_name')->id('inputLast')->placeholder('auth.login_failed');

Forma::label('auth.login_failed');

Forma::label('<i class="fa fa-pound"></i> Price')->rawText();

Forma::select('country')->option('- Please Select -')->option('UK',1,true)->withLabel('Select Country');

Forma::select('country')->options(array('1' => 'United Kingdom', '2' => 'France', '3' => 'USA' ));

Forma::select('town', array('1' => 'Chelmsford', '2' => 'Brentwood', '3' => 'Colchester' ), 2);

Forma::checkbox('cake',1);

Forma::button('Click me!!', 'submit')->class('btn btn-primary');

Forma::submit('submit_btn','Save Changes');

Forma::close();

forma's People

Contributors

glennjacobs avatar aaronneondigital avatar alecritson avatar

Watchers

 avatar James Cloos avatar Łukasz Witkowski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.