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

Documentation generated on Mon, 11 Mar 2019 15:47:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.