advcheckbox в QuickForm

  • Автор темы Автор темы idencial
  • Дата начала Дата начала

idencial

Одинаковый
advcheckbox в QuickForm

при создании advcheckbox элемента в QuickForm
PHP:
$form->addElement('advcheckbox', 'show', 'Show');
Выводит
PHP:
<input name="__show" type="checkbox" value="1" id="qf_6f99a4" checked="checked" onclick="if (this.checked) { this.form['show'].value='1'; }else { this.form['show'].value=''; } " /><input type="hidden" name="show" value="1" />
А можно сделать так, чтобы когда он не отмечен было не '', а 0?
 
блин, а самому посмотреть?
PHP:
$form->addElement('advcheckbox', 'show', 'Show', null, array(0, 1));
 
Извини, тормознул

-~{}~ 12.10.04 01:59:

Блин, а теперь на
PHP:
$form->addElement('advcheckbox', 'show', 'Show', null, array(0, 1));
он выводит
PHP:
<input 0="0" 1="1" name="__show" type="checkbox" value="1" id="qf_e0701e" onclick="if (this.checked) { this.form['show'].value='1'; }else { this.form['show'].value=''; } " /><input type="hidden" name="show" value="" />

Баг или я торможу?
 
Виноват:
PHP:
$form->addElement('advcheckbox', 'show', 'Show', null, null, array(0, 1));
 
Спасибо, на этот раз все правильно
Только интересно почему в мане
PHP:
void constructor HTML_QuickForm_advcheckbox::HTML_QuickForm_advcheckbox ([string $elementName = NULL [, string $elementLabel = NULL [, string $text = NULL [, mixed $attributes = NULL [, mixed $values = NULL]]]]])
+ в самом классе
PHP:
function HTML_QuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null)
    {
        $this->HTML_QuickForm_checkbox($elementName, $elementLabel, $text, $attributes);
        $this->setValues($values);
    }
Значения идут как пятый атрибут, а срабатывает правильно когда указываешь их как шестой.
 
Автор оригинала: idencial
Значения идут как пятый атрибут, а срабатывает правильно когда указываешь их как шестой.
Патамушта в документации написано:
Adds an element into the form. If $element is a string representing an element type, then this method accepts variable number of parameters, their meaning and count depending on element type.

Parameters starting from second will be passed to the element's constructor, consult the docs for the appropriate element to find out which parameters to pass.
соответственно 2--6 параметры addElement() == 1--5 параметры конструктора.
 
Сверху