Adding addElement('button') in formvalidator (shortcut of style_submit_button)

skala
Julio Montoya 14 years ago
parent 0675e5debe
commit 55a9085b3a
  1. 7
      main/inc/lib/formvalidator/Element/style_button.php
  2. 18
      main/inc/lib/formvalidator/Element/style_submit_button.php
  3. 9
      main/inc/lib/formvalidator/FormValidator.class.php

@ -37,10 +37,6 @@ require_once 'HTML/QuickForm/element.php';
*/
class HTML_QuickForm_stylebutton extends HTML_QuickForm_element
{
// {{{ properties
/* Path to image */
// {{{ constructor
/**
* Class constructor
@ -52,8 +48,7 @@ class HTML_QuickForm_stylebutton extends HTML_QuickForm_element
* @access public
* @return void
*/
function HTML_QuickForm_stylebutton($elementName=null, $elementLabel=null, $attributes=null)
{
function HTML_QuickForm_stylebutton($elementName=null, $elementLabel=null, $attributes=null) {
$this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
} //end constructor

@ -51,24 +51,22 @@ class HTML_QuickForm_stylesubmitbutton extends HTML_QuickForm_stylebutton
* @access public
* @return void
*/
function HTML_QuickForm_stylesubmitbutton($elementName=null, $value=null, $attributes=null,$img=null)
{
function HTML_QuickForm_stylesubmitbutton($elementName=null, $value=null, $attributes=null,$img=null) {
if (!isset($attributes['class'])) {
$attributes['class'] = 'btn';
}
HTML_QuickForm_stylebutton::HTML_QuickForm_stylebutton($elementName, null, $attributes, $value, $img);
$this->setValue($value);
$this->setType('submit');
} //end constructor
// }}}
// {{{ freeze()
/**
* Freeze the element so that only its value is returned
*
* @access public
* @return void
*/
function freeze()
{
function freeze() {
return false;
} //end func freeze
@ -79,12 +77,8 @@ class HTML_QuickForm_stylesubmitbutton extends HTML_QuickForm_stylebutton
* Only return the value if it is found within $submitValues (i.e. if
* this particular submit button was clicked)
*/
function exportValue(&$submitValues, $assoc = false)
{
function exportValue(&$submitValues, $assoc = false) {
return $this->_prepareValue($this->_findValue($submitValues), $assoc);
}
// }}}
} //end class HTML_QuickForm_submit

@ -132,10 +132,11 @@ class FormValidator extends HTML_QuickForm
$this->registerElementType('datepickerdate', $dir . 'Element/datepickerdate.php', 'HTML_QuickForm_datepickerdate');
$this->registerElementType('receivers', $dir . 'Element/receivers.php', 'HTML_QuickForm_receivers');
$this->registerElementType('select_language', $dir . 'Element/select_language.php', 'HTML_QuickForm_Select_Language');
$this->registerElementType('select_theme', $dir . 'Element/select_theme.php', 'HTML_QuickForm_Select_Theme');
$this->registerElementType('style_button', $dir . 'Element/style_button.php', 'HTML_QuickForm_stylebutton');
$this->registerElementType('select_theme', $dir . 'Element/select_theme.php', 'HTML_QuickForm_Select_Theme');
$this->registerElementType('style_submit_button', $dir . 'Element/style_submit_button.php', 'HTML_QuickForm_stylesubmitbutton');
$this->registerElementType('style_reset_button', $dir . 'Element/style_reset_button.php', 'HTML_QuickForm_styleresetbutton');
$this->registerElementType('style_reset_button', $dir . 'Element/style_reset_button.php', 'HTML_QuickForm_styleresetbutton');
$this->registerElementType('button', $dir . 'Element/style_submit_button.php', 'HTML_QuickForm_stylesubmitbutton');
$this->registerRule('date', null, 'HTML_QuickForm_Rule_Date', $dir . 'Rule/Date.php');
$this->registerRule('date_compare', null, 'HTML_QuickForm_Rule_DateCompare', $dir . 'Rule/DateCompare.php');
$this->registerRule('html', null, 'HTML_QuickForm_Rule_HTML', $dir . 'Rule/HTML.php');
@ -145,6 +146,8 @@ class FormValidator extends HTML_QuickForm
$this->registerRule('multiple_required', 'required', 'HTML_QuickForm_Rule_MultipleRequired', $dir . 'Rule/MultipleRequired.php');
$this->registerRule('url', null, 'HTML_QuickForm_Rule_Url', $dir . 'Rule/Url.php');
$this->registerRule('compare_fields', null, 'HTML_QuickForm_Compare_Fields', $dir . 'Rule/CompareFields.php');
// Modify the default templates
$renderer = & $this->defaultRenderer();

Loading…
Cancel
Save