Development

Changeset 28338 for plugins/sfDoctrineDynamicFormRelationsPlugin

You must first sign up to be able to contribute.

Show
Ignore:
Timestamp:
03/02/10 10:16:38 (3 years ago)
Author:
Kris.Wallsmith
Message:

[sfDoctrineDynamicFormRelationsPlugin] enhanced the readme

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfDoctrineDynamicFormRelationsPlugin/branches/1.3/README

    r28337 r28338  
    11This plugin allows you to embed related forms in a Doctrine form class, 
    2 manipulate those embedded forms (i.e. add more, remove some, etc), and see 
    3 those relations updated when the form is processed. 
     2manipulate those embedded forms using JavaScript (i.e. add more, remove some, 
     3etc), and will automatically updates those relations when the form is 
     4processed. 
    45 
    56    [php] 
     
    89      public function configure() 
    910      { 
    10         $this->embedDynamicRelation('Books as books'); 
     11        $this->embedDynamicRelation('books'); 
    1112      } 
    1213    } 
     14 
     15This form can now be rendered something like this, enhanced with JavaScript: 
     16 
     17    [html] 
     18    <form action="#" method="post"> 
     19      <!-- ... --> 
     20      <ul> 
     21        <?php foreach ($form['books'] as $bookFields): ?> 
     22          <li> 
     23            <table><?php echo $bookFields ?></table> 
     24            <a href="javascript:remove(this)">remove this book</a> 
     25          </li> 
     26        <?php endforeach ?> 
     27      </ul> 
     28      <a href="javascript:add()">add another book</a> 
     29      <!-- ... --> 
     30    </form> 
     31 
     32Once your JavaScript is setup (which is up to you), your user can remove some 
     33of the listed books and add a few more. Then, once the form is submitted, the 
     34database will be updated to reflect those changes. 
    1335 
    1436Limitations 
    1537----------- 
    1638 
    17  * The primary key of the related model must by "id" 
     39 * The primary key of the related model must be "id" 
    1840 * The embedded form class must include an "id" field 
    1941