← Back to team overview

anewt-developers team mailing list archive

[Branch ~uws/anewt/anewt.uws] Rev 1701: [form] Only include hidden fieldset if form has hidden controls

 

------------------------------------------------------------
revno: 1701
committer: Wouter Bolsterlee <uws@xxxxxxxxx>
branch nick: anewt.uws
timestamp: Tue 2009-07-21 20:54:20 +0200
message:
  [form] Only include hidden fieldset if form has hidden controls
  
  Also avoid Doxygen warnings.
modified:
  form/controls/choice.lib.php
  form/renderer/base.lib.php

=== modified file 'form/controls/choice.lib.php'
--- form/controls/choice.lib.php	2009-04-12 23:02:08 +0000
+++ form/controls/choice.lib.php	2009-07-21 18:54:20 +0000
@@ -632,6 +632,9 @@
 	 *
 	 * Set the value for this group.
 	 *
+	 * \param $values
+	 *   Array of values
+	 *
 	 * This method is only intended to be called internally.
 	 */
 	public function set_value($values)
@@ -647,6 +650,9 @@
 	 *
 	 * Make sure a selection is set.
 	 *
+	 * \param $force_first
+	 *   Whether to forcibly enable the first option
+	 *
 	 * This method is for internal use only.
 	 */
 	public function _ensure_selection($force_first=false)

=== modified file 'form/renderer/base.lib.php'
--- form/renderer/base.lib.php	2009-07-19 20:14:37 +0000
+++ form/renderer/base.lib.php	2009-07-21 18:54:20 +0000
@@ -94,12 +94,18 @@
 		/* The HTML DTD does not allow <input> elements as direct childs of
 		 * a <form> element. Use a <fieldset> that is completely hidden from
 		 * view instead. */
-		$hidden_controls_fieldset = new AnewtXHTMLFieldset();
-		$hidden_controls_fieldset->set_attribute('style', 'display: none;');
-		foreach ($this->_form->_hidden_controls() as $hidden_control)
-			$hidden_controls_fieldset->append_child($hidden_control->build_widget());
-
-		$form->append_child($hidden_controls_fieldset);
+		$hidden_controls = $this->_form->_hidden_controls();
+		if ($hidden_controls)
+		{
+			$hidden_controls_fieldset = new AnewtXHTMLFieldset();
+			$hidden_controls_fieldset->set_attribute('style', 'display: none;');
+
+			foreach ($hidden_controls as $hidden_control)
+				$hidden_controls_fieldset->append_child($hidden_control->build_widget());
+
+			$form->append_child($hidden_controls_fieldset);
+		}
+
 
 		return $form;
 	}



--
lp:anewt
https://code.launchpad.net/~uws/anewt/anewt.uws

Your team Anewt developers is subscribed to branch lp:anewt.
To unsubscribe from this branch go to https://code.launchpad.net/~uws/anewt/anewt.uws/+edit-subscription.