posted by jwerner on Thursday, September 20, 2012 1:39 PM

This mini tutorial describes how to highlight a form row in Yii applications, when form controls are clicked.

Below is some code Yii generates for a single form control, e.g. an text input field:

<div class="row">
    <?php echo $form->labelEx($model,'intro'); ?>
    <?php echo $form->textArea($model,'intro',array('cols'=>50,'rows'=>4)); ?>
    <?php echo $form->error($model,'intro'); ?>

To highlight the div row when the input element inside the div row is clicked or focused, add this code below the form markup:

<?php Yii::app()->clientScript->registerScript('divRowClicked',
'jQuery("div.row input,textarea,select").on("click focus", function() {
    // Remove previously highlighted div.rows:
    // Highlight the div.row in a light grey:
});'); ?>


No comments

Please enter the letters as they are shown in the image above.
Letters are not case-sensitive.

Add comment

Change Log

Created OnSep 20, 2012 1:39:08 PM CEST
Created ByJoachim Werner
Updated OnSep 20, 2012 1:45:19 PM CEST
Updated ByJoachim Werner