← Back to team overview

anewt-developers team mailing list archive

[Branch ~uws/anewt/anewt.uws] Rev 1811: [form] Only include id attribute if actually set

 

------------------------------------------------------------
revno: 1811
committer: Wouter Bolsterlee <uws@xxxxxxxxx>
branch nick: anewt
timestamp: Tue 2010-11-09 21:56:34 +0100
message:
  [form] Only include id attribute if actually set
  
  Not all forms have an id attribute; a default value is
  automatically deduced only for AnewtForm subclasses. This
  means the renderer was broken if AnewtForm was used directly
  (without subclassing).
modified:
  form/renderer/base.lib.php


--
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
=== modified file 'form/renderer/base.lib.php'
--- form/renderer/base.lib.php	2010-02-24 20:50:42 +0000
+++ form/renderer/base.lib.php	2010-11-09 20:56:34 +0000
@@ -67,14 +67,14 @@
 
 		/* Default attributes */
 
-		$id = $this->_form->_get('id');
-
 		$attributes = array(
 			'method' => $this->_form->get('method-as-string'),
 			'action' => $this->_form->_get('action'),
-			'id'     => $id,
 		);
 
+		if ($this->_form->_isset('id'))
+			$attributes['id'] = $this->_form->_get('id');
+
 		/* Encoding type */
 
 		if ($this->_form->_contains_file_upload_control())