[commits] [Wiki] changed: Project/HordeForm

Jan Schneider jan at horde.org
Thu Mar 31 09:41:16 UTC 2011


jan  Thu, 31 Mar 2011 09:41:16 +0000

Modified page: http://wiki.horde.org/Project/HordeForm
New Revision:  17.8
Change log:  Fix rendering

@@ -172,9 +172,9 @@


  Horde_Form
  1 class/file for autoload
-__autoload file (all types?)
+autoload file (all types?)
  Horde_Form_Variable_View ?
  rename Variable to Field?
  keep type separate but make basic api as clean and small as possible
  Horde_Form_Type -> standard constructor for all types instead of factory
@@ -424,8 +424,9 @@

  However, I don't think "addElement" needs to exist in Quickform2.  Have
  you considered an API similar to the following?

+<code type="php">
  <?php

  $form = new HTML_Quickform2;
  $form['action'] = '/path/to/action.php';
@@ -445,11 +446,13 @@
  $select = $g->select['aSelect']; // or $form->select['aSelect'];
  $select->options['another'] = 1;
  $select->validate['custom'] = 'is_numeric';
  ?>
+</code>

  Compare this to:

+<code type="php">
  <?php

  $form = new HTML_Quickform2('/path/to/action.php', 'method' => 'post');
  $form->addGroup('mygroup');
@@ -459,8 +462,9 @@
  $sel = $form->addElement('select', 'aSelect', array(...));
  $sel->addOption('another', 1);
  $sel->validate('custom', 'is_numeric');
  ?>
+</code>

  In the second example, my eyes are drawn to a bunch of "add*" and it
  appears that the important information ('text', 'select') is secondary.
   It takes me a while to figure out what is actually being done.  The
@@ -653,8 +657,9 @@

  However, I don't think "addElement" needs to exist in Quickform2.  Have
  you considered an API similar to the following?

+<code type="php">
  <?php

  $form = new HTML_Quickform2;
  $form['action'] = '/path/to/action.php';
@@ -674,8 +679,10 @@
  $select = $g->select['aSelect']; // or $form->select['aSelect'];
  $select->options['another'] = 1;
  $select->validate['custom'] = 'is_numeric';
  ?>
+</code>
+
  With all due respect, SimpleXML API which you seem to use as  
inspiration here uses
  addAttribute() and addChild() methods for adding attributes and  
child nodes, it doesn't
  work as shown above. ;)

@@ -844,8 +851,9 @@

  However, I don't think "addElement" needs to exist in Quickform2.  Have
  you considered an API similar to the following?

+<code type="php">
  <?php

  $form = new HTML_Quickform2;
  $form['action'] = '/path/to/action.php';
@@ -865,11 +873,13 @@
  $select = $g->select['aSelect']; // or $form->select['aSelect'];
  $select->options['another'] = 1;
  $select->validate['custom'] = 'is_numeric';
  ?>
+</code>

  Compare this to:

+<code type="php">
  <?php

  $form = new HTML_Quickform2('/path/to/action.php', 'method' => 'post');
  $form->addGroup('mygroup');
@@ -879,9 +889,9 @@
  $sel = $form->addElement('select', 'aSelect', array(...));
  $sel->addOption('another', 1);
  $sel->validate('custom', 'is_numeric');
  ?>
-
+</code>
  In the second example, my eyes are drawn to a bunch of "add*" and it
  appears that the important information ('text', 'select') is secondary.
  It takes me a while to figure out what is actually being done.  The
  first example has no superfluous information, but simply sets up the



More information about the commits mailing list