I just chased my tail around for a bit today. I got lost with setting the status of all inputs, and banging my head on why the "validate" function just wasn't working.
I just chased my tail around for a bit today. I got lost with setting the status of all inputs, and banging my head on why the "validate" function just wasn't working.
There are numerous usability problems:
This wiki is to show you how to use jQuery get and JSON to get data from a dropdown/any form field and fill form fields with the values instantaneously. First, I'll give example use cases of what I'm going to teach you so you can quickly see if this is for you.
In yii2 we can create form without create FormModel. Here we go
Are you using the Bootstrap 3 form styles with Yii 2 Active Forms? Have you faced problems in displaying complex layouts which needs you to display multiple inline form fields in a single row, within bootstrap horizontal forms. Then read on.
Let's take the example of the above article to display an email button next to a delete button:
This wiki will explain how you can use the Field range extension with multiple Bootstrap form layouts (vertical or horizontal). You maybe aware, that the yii2-field-range extension enables you to easily setup ActiveField range fields with Bootstrap styling. You basically can setup two attributes joined together like a single field with combined validation error block.
In this wiki I will show you how to save/update a model with many related model For example: How to set a product to multiple categories only in one post form ?
Suppose you want to have a list in Category with its related products and you want to updates the list (removing or insert product items) This wiki show us how to do that
// In Yii 1.x $form = $this->beginWidget('CActiveForm', [
'id' => 'order-search-form',
'method' => 'get',
]);
echo $form->textInput($searchModel, 'id');
echo CHtml::submitButton('Find', ['class' => 'btn btn-primary']);
$this->endWidget();
`
In this article you'll learn how to send additional form data when uploading files using XUpload widget
In this mini howto I would like to show how to add a required captcha field in the login form, after a defined number of unsuccessfull attempts. To do this, I will use the blog demo that you have in default Yii download package (path/to/yii/demos/blog).
For each column of the CGridView, we can specify name
, value
, htmlOptions
, cssClassExpression
etc. In the declarations of the attributes value
and cssClassExpression
we can use the "special" variable $data
, for example like this: 'value'=>'$data->author->username',
.
Now we might want to use $data
in the declaration of the `...
Suppose to have two models: Users and Emails. You do not want to store email in a Users model. And User can have 0 or many emails. This is the form generated to create a new user (just username).
I'm developing a website that has an option to look up a car's registration number via SOAP and return additional details such as make, model, colour etc.
<?php $this->widget('zii.widgets.grid.CGridView', array(
'dataProvider' => $dataprovider,
'id'=>'recipient_table',
'selectionChanged'=>'updateEditForm',
'columns' => array(
'rec_id',
'org.nachname',
'org.vorname',
'org_id',
array(
'class'=>'CButtonColumn',
'template'=>'{...
In this simple example I'll demonstrate how to extend CActiveForm class to overload some drawing functions to achieve some commonly used fixes in forms.
Here is overloaded version of CActiveForm.labelEx that adds colon (:) at the end of text of label with respecting CHtml::$afterRequiredLabel and CHtml::$beforeRequiredLabel