Structures_DataGrid
[ class tree: Structures_DataGrid ] [ index: Structures_DataGrid ] [ all elements ]

Source for file htmleditform-tableless.php

Documentation is available at htmleditform-tableless.php

  1. <?php
  2. // don't forget to include the stylesheet to get a reasonable layout
  3.  
  4. require_once 'Structures/DataGrid.php';
  5. require_once 'HTML/QuickForm/DHTMLRulesTableless.php';
  6. require_once 'HTML/QuickForm/Renderer/Tableless.php';
  7.  
  8. $datagrid =new Structures_DataGrid();
  9. $datagrid->bind(...);  // bind your data here
  10.  
  11. // create the form object, using DHTMLRules
  12. $form = new HTML_QuickForm_DHTMLRulesTableless('editform'nullnull,
  13.                                                nullnulltrue);
  14. $form->removeAttribute('name');  // for XHTML validity
  15.  
  16. // to get a legend for the fieldset, we add a header element
  17. $form->addElement('header''header''EditForm example');
  18.  
  19. // fill() makes the renderer to generate the needed form elements
  20. $datagrid->fill($formnull'HTMLEditForm');
  21.  
  22. // we have to add a submit button ourselves
  23. $form->addElement('submit'null'Submit');
  24.  
  25. // to show the DHTMLRules functionality, we add a required rule
  26. // (we assume that there is an element with name 'id')
  27. $form->addRule('id''Please enter the ID.''required'null'client');
  28.  
  29. // to get validation onChange/onBlur events, we need the following call
  30. $form->getValidationScript();
  31.  
  32. // instantiate the tableless renderer and output the form
  33. $renderer =new HTML_QuickForm_Renderer_Tableless();
  34. $form->accept($renderer);
  35. echo $renderer->toHtml();
  36. ?>

Documentation generated on Tue, 18 Dec 2007 11:30:13 -0500 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.