DataForm (advanced stuffs)

Samples of autocomplete feature (in development).
All use twitter typehaead and Bloodhound (Suggestion Engine).
The last one also uses TagsInput.

  • The most simple is the first one, it simply builds a local json array using options()
  • The second one is the smarter, using relation.fieldname as fieldname and search(array of search fields)
    rapyd will manage an ajax request to instace a related entity, search on search fields, and store the foreign key on select
  • The third is the more complete, it is like the second one with the added ability to customize the search query
  • The last is a sample of the "tags" field to manage a belongsToMany and it also supports search() and remote()

The only options available in this demo are "Jane" and "Jhon", it is just a test form to show it works properly.
In the same spirit, the only categories available are "Category 1" up to "Category 5".

class DemoController extends Controller


    public function 
$form = \DataForm::source(Article::find(1));


//simple autocomplete on options (built as local json array)

//autocomplete with relation.field to manage a belongsToMany

//autocomplete with relation.field,  returned key,  custom remote ajax call (see at bottom)

//tags with relation.field to manage a belongsToMany, it support also remote()


$form->saved(function () use ($form) {
$form->message("ok record saved");
$form->link("/rapyd-demo/advancedform","back to the form");


    public function 
//needed only if you want a custom remote ajax call for a custom search
return Author::where("firstname","like", \Input::get("q")."%")
orWhere("lastname","like", \Input::get("q")."%")->take(10)->get();