yii\helpers\BaseHtml::activeHiddenInput PHP Метод

activeHiddenInput() публичный статический Метод

This method will generate the "name" and "value" tag attributes automatically for the model attribute unless they are explicitly specified in $options.
public static activeHiddenInput ( Model $model, string $attribute, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$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()]]. See [[renderTagAttributes()]] for details on how attributes are being rendered.
Результат string the generated input tag
    public static function activeHiddenInput($model, $attribute, $options = [])
    {
        return static::activeInput('hidden', $model, $attribute, $options);
    }

Usage Example

Пример #1
0
echo $form->field($model, 'website')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'place_type')->dropDownList($model->getPlaceTypeOptions(), ['prompt' => 'What type of place is this?'])->label('Type of Place');
?>
            
    <?php 
echo $form->field($model, 'notes')->textArea();
?>

    <?php 
echo BaseHtml::activeHiddenInput($model, 'lat');
?>
    <?php 
echo BaseHtml::activeHiddenInput($model, 'lng');
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

</div> <!-- end col 1 --><div class="col-md-6">
<div id="preSearch" class="center">
<p><br /></p>    <?php 
echo Html::a('Lookup Location', ['lookup'], ['class' => 'btn btn-success', 'onclick' => "javascript:beginSearch();return false;"]);
?>
 
</div>
All Usage Examples Of yii\helpers\BaseHtml::activeHiddenInput