numberFieldControlGroup() public static method

Generates a control group with a number field.
See also: self::textInputField
public static numberFieldControlGroup ( string $name, string $value = '', array $htmlOptions = [] ) : string
$name string the input name.
$value string the input value.
$htmlOptions array additional HTML attributes.
return string the generated control group.
示例#1
0
 public function testNumberFieldControlGroup()
 {
     $I = $this->codeGuy;
     $html = TbHtml::numberFieldControlGroup('number', 'number');
     $group = $I->createNode($html, 'div.control-group');
     $label = $group->filter('label.control-label');
     $I->seeNodeChildren($label, array('input[type=number]'));
 }
示例#2
0
$html_ul = '<ul>';
$widgetid = $this->id;
// output an input field for each currency, so end user doesn't try to trick us by entering
// USD values as BTC or similar tricks
$inputname = CHtml::activeId($model, $attribute) . '-currency-input';
foreach ($supported_currencies as &$supported_currency) {
    $style = "position:relative;";
    $html_ul .= "<li><a class='select-currency' data='{$widgetid}-{$supported_currency}' >{$supported_currency}</a></li>";
    if (!($supported_currency == $currency)) {
        $style .= ' display: none; ';
    }
    echo "<span name='{$widgetid}-currency-control' data='{$widgetid}-{$supported_currency}' style='{$style}'>";
    echo "<span name='{$widgetid}-currency-badge' class='currency-badge'>{$supported_currency}</span>";
    $htmlOptions['name'] = $inputname;
    echo TbHtml::numberFieldControlGroup($inputname, '', $htmlOptions);
    echo "</span>";
}
$html_ul .= '</ul>';
echo $form->hiddenField($model, $attribute);
$hiddenId = CHtml::activeId($model, $attribute);
Yii::app()->clientScript->registerScript('currency-change-' . $widgetid, <<<END
\t\$('input[name={$inputname}]').keyup(function() {
\t\t\$('#{$hiddenId}').val(\$(this).val());
\t});
END
, CClientScript::POS_END);
if (count($supported_currencies) > 1) {
    $select_currency_msg = Yii::t('translation', 'Select currency');
    $cancel_msg = Yii::t('translation', 'Cancel');
    Yii::app()->clientScript->registerScript('current-switch-' . $widgetid, <<<END