Skip to content

chuprik/yii-localstorage-activeform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

yii-localstorage-activeform

LocalStorageActiveForm is the wrapper for the jquery_remember_state.

Usage

Example:

<?php $form = $this->beginWidget('ext.yii-localstorage-activeform.LocalStorageActiveForm') ?>

<div class="row">
    <?= $form->labelEx($model, 'textAttribute') ?>
    <?= $form->textField($model, 'textAttribute') ?>
    <?= $form->error($model, 'textAttribute') ?>
</div>
<div class="row">
    <?= $form->labelEx($model, 'textAreaAttribute') ?>
    <?= $form->textArea($model, 'textAreaAttribute') ?>
    <?= $form->error($model, 'textAreaAttribute') ?>
</div>
<div class="row">
    <?= $form->labelEx($model, 'singleCheckBoxAttribute') ?>
    <?= $form->checkBox($model, 'singleCheckBoxAttribute') ?>
    <?= $form->error($model, 'singleCheckBoxAttribute') ?>
</div>
<div class="row">
    <?= $form->labelEx($model, 'checkBoxListAttribute') ?>
    <?= $form->checkBoxList($model, 'checkBoxListAttribute', array(
        'firstValue' => 'firstTitle',
        'secondValue' => 'secondTitle',
    )) ?>
    <?= $form->error($model, 'checkBoxListAttribute') ?>
</div>
<div class="row">
    <?= $form->labelEx($model, 'radioButtonListAttribute') ?>
    <?= $form->radioButtonList($model, 'radioButtonListAttribute', array(
        'firstValue' => 'firstTitle',
        'secondValue' => 'secondTitle',
    )) ?>
    <?= $form->error($model, 'radioButtonListAttribute') ?>
</div>
<div class="row">
    <?= $form->labelEx($model, 'dropDownListAttribute') ?>
    <?= $form->dropDownList($model, 'dropDownListAttribute', array(
        'firstValue' => 'firstTitle',
        'secondValue' => 'secondTitle',
    )) ?>
    <?= $form->error($model, 'dropDownListAttribute') ?>
</div>

<div class="row"><?= CHtml::submitButton() ?></div>

<?php $this->endWidget() ?>

Example with jquery_remember_state options:

<?php $form = $this->beginWidget('ext.yii-localstorage-activeform.LocalStorageActiveForm', array(
    'enableSaveToLocalStorage' => true, // Set false or closure for disable save
    'options' => array(
        'ignore' => array('Model[textAttribute]'),
        'clearOnSubmit' => false,
    ),
)) ?>

<div class="row">
    <?= $form->labelEx($model, 'textAttribute') ?>
    <?= $form->textField($model, 'textAttribute') ?>
    <?= $form->error($model, 'textAttribute') ?>
</div>
<div class="row">
    <?= $form->labelEx($model, 'textAreaAttribute') ?>
    <?= $form->textArea($model, 'textAreaAttribute') ?>
    <?= $form->error($model, 'textAreaAttribute') ?>
</div>
<div class="row">
    <?= $form->labelEx($model, 'singleCheckBoxAttribute') ?>
    <?= $form->checkBox($model, 'singleCheckBoxAttribute') ?>
    <?= $form->error($model, 'singleCheckBoxAttribute') ?>
</div>
<div class="row">
    <?= $form->labelEx($model, 'checkBoxListAttribute') ?>
    <?= $form->checkBoxList($model, 'checkBoxListAttribute', array(
        'firstValue' => 'firstTitle',
        'secondValue' => 'secondTitle',
    )) ?>
    <?= $form->error($model, 'checkBoxListAttribute') ?>
</div>
<div class="row">
    <?= $form->labelEx($model, 'radioButtonListAttribute') ?>
    <?= $form->radioButtonList($model, 'radioButtonListAttribute', array(
        'firstValue' => 'firstTitle',
        'secondValue' => 'secondTitle',
    )) ?>
    <?= $form->error($model, 'radioButtonListAttribute') ?>
</div>
<div class="row">
    <?= $form->labelEx($model, 'dropDownListAttribute') ?>
    <?= $form->dropDownList($model, 'dropDownListAttribute', array(
        'firstValue' => 'firstTitle',
        'secondValue' => 'secondTitle',
    )) ?>
    <?= $form->error($model, 'dropDownListAttribute') ?>
</div>

<div class="row"><?= CHtml::submitButton() ?></div>

<?php $this->endWidget() ?>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages