diff options
Diffstat (limited to 'core/Form.php')
-rw-r--r-- | core/Form.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/Form.php b/core/Form.php index 6c00803938..4dfbdc087e 100644 --- a/core/Form.php +++ b/core/Form.php @@ -23,13 +23,13 @@ abstract class Piwik_Form extends HTML_QuickForm { protected $a_formElements = array(); - function __construct( $action = '' ) + function __construct( $action = '', $attributes = '' ) { if(empty($action)) { $action = Piwik_Url::getCurrentQueryString(); } - parent::HTML_QuickForm('form', 'POST', $action); + parent::HTML_QuickForm('form', 'POST', $action, $target='', $attributes); $this->registerRule( 'checkEmail', 'function', 'Piwik_Form_isValidEmailString'); $this->registerRule( 'fieldHaveSameValue', 'function', 'Piwik_Form_fieldHaveSameValue'); @@ -96,6 +96,16 @@ abstract class Piwik_Form extends HTML_QuickForm } } } + function setSelected( $nameElement, $value ) + { + foreach( $this->_elements as $key => $value) + { + if($value->_attributes['name'] == $nameElement) + { + $this->_elements[$key]->_attributes['selected'] = 'selected'; + } + } + } } function Piwik_Form_fieldHaveSameValue($element, $value, $arg) |