Location: PHPKode > projects > Agile Toolkit > atk4-atk4-addons-efc6814/misc/lib/InfiniteAddForm.php
class InfiniteAddForm extends View {
       Infinite add form for specified model
    public $c;
    public $form;
    function setModel($m){

    function addForm($u){

        // This argument is passed when 2nd, 3rd etc forms are loaded. We should preserve it to submit proprely

        // Horizontal form is good for 4 fields. Most of the behaviour can be changed through Controller

        // No buttons

        // Determine first and last field in form
        foreach($f->elements as $element){
            if(!($element instanceof Form_Field))continue;

        // Calculate identifier for the next form in line. Those should be unique

        // Focusing first field triggers loading of additional form. This way it has plenty of time to load
        // by the time this form is filled out. Also drop binding to avoid double-loading
                $this->js()->append('<div id="'.$un.'"/>'),

        // Bluring of last field will submit theform
    function jsSuccess($js,$m){
        return $js->univ()->successMessage('Record Saved (id='.$m->id.')');
Return current item: Agile Toolkit