<div class="col-xs-12">
    <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm'); ?>


<!--<p class="note"><?php echo UserModule::t('Fields with <span class="required">*</span> are required.'); ?></p>-->

    <?php echo $form->errorSummary($model); ?>

    <?php echo $form->textFieldControlGroup($model, 'varname', array('maxlength' => 50, 'readonly' => $model->id !== NULL, 'help' => UserModule::t("Allowed lowercase letters and digits."))); ?>

    <?php echo $form->textFieldControlGroup($model, 'title', array('maxlength' => 255, 'help' => UserModule::t('Field name on the language of "sourceLanguage".'))); ?>

    <?php echo $form->textFieldControlGroup($model, 'field_type', array('maxlength' => 50, 'help' => UserModule::t('Field type column in the database.'))); ?>

    <?php echo $form->textFieldControlGroup($model, 'field_size', array('maxlength' => 50, 'readonly' => $model->id !== NULL, 'help' => UserModule::t("Field size column in the database."))); ?>

    <?php echo $form->textFieldControlGroup($model, 'field_size_min', array('maxlength' => 50, 'help' => UserModule::t('The minimum value of the field (form validator).'))); ?>

    <?php echo $form->dropDownListControlGroup($model, 'required', ProfileField::itemAlias('required'), array('help' => UserModule::t('Required field (form validator).'))); ?>

    <?php echo $form->textFieldControlGroup($model, 'match', array('maxlength' => 255, 'help' => UserModule::t("Regular expression (example: '/^[A-Za-z0-9\s,]+$/u')."))); ?>

    <?php echo $form->textFieldControlGroup($model, 'range', array('maxlength' => 5000, 'help' => UserModule::t('Predefined values (example: 1;2;3;4;5 or 1==One;2==Two;3==Three;4==Four;5==Five).'))); ?>

    <?php echo $form->textFieldControlGroup($model, 'error_message', array('maxlength' => 255, 'help' => UserModule::t('Error message when you validate the form.'))); ?>

    <?php echo $form->textFieldControlGroup($model, 'other_validator', array('maxlength' => 255, 'help' => UserModule::t('JSON string (example: {example}).', array('{example}' => CJavaScript::jsonEncode(array('file' => array('types' => 'jpg, gif, png'))))))); ?>

    <?php echo $form->textFieldControlGroup($model, 'default', array('maxlength' => 255, 'readonly' => $model->id !== NULL, 'help' => UserModule::t("The value of the default field (database)."))); ?>

    <?php list($widgetsList) = ProfileFieldController::getWidgets($model->field_type); ?>

    <?php echo $form->dropDownListControlGroup($model, 'widget', $widgetsList, array('id' => 'widgetlist', 'help' => 'Widget name.')); ?>

    <?php echo $form->textFieldControlGroup($model, 'widgetparams', array('maxlength' => 5000, 'id' => 'widgetparams', 'help' => UserModule::t('JSON string (example: {example}).', array('{example}' => CJavaScript::jsonEncode(array('param1' => array('val1', 'val2'), 'param2' => array('k1' => 'v1', 'k2' => 'v2'))))))); ?>

    <?php echo $form->textFieldControlGroup($model, 'position', array('maxlength' => 255, 'help' => UserModule::t('Display order of fields.'))); ?>

    <?php echo $form->dropDownListControlGroup($model, 'visible', ProfileField::itemAlias('visible')); ?>

    <?php echo TbHtml::formActions(array(CHtml::submitButton($model->isNewRecord ? Yii::t('admin', 'Create') : Yii::t('admin', 'Save'), array('class' => 'btn btn-primary')))); ?>

    <?php $this->endWidget(); ?>
</div>
<div id="dialog-form" title="<?php echo UserModule::t('Widget parametrs'); ?>">
    <form>
        <fieldset>
            <label for="name">Name</label>
            <input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all" />
            <label for="value">Value</label>
            <input type="text" name="value" id="value" value="" class="text ui-widget-content ui-corner-all" />
        </fieldset>
    </form>
</div>
