yii\helpers\BaseHtml::hiddenInput PHP Method

hiddenInput() public static method

Generates a hidden input field.
public static hiddenInput ( string $name, string $value = null, array $options = [] ) : string
$name string the name attribute.
$value string the value attribute. If it is null, the value attribute will not be generated.
$options array the tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
return string the generated hidden input tag
    public static function hiddenInput($name, $value = null, $options = [])
    {
        return static::input('hidden', $name, $value, $options);
    }

Usage Example

Beispiel #1
0
<div class="password-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo Html::button('Generate Password', array('id' => 'generate_password'));
?>
    <?php 
echo Html::button('Toggle Password', array('id' => 'toggle_password'));
?>

    <p>
        <?php 
echo BaseHtml::hiddenInput('Password[id]', $model->id);
?>

        <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>

        <?php 
echo $form->field($model, 'group')->textInput(['maxlength' => true]);
?>

        <?php 
echo $form->field($model, 'username')->textInput(['maxlength' => true]);
?>

        <?php