Hello there,
I’ve created a data entry form with YII but i’d like to have TextField displayed inline with the Labels. By default they are diplayed below…
any idea how i might achieve this?
thanks in advance.
Hello there,
I’ve created a data entry form with YII but i’d like to have TextField displayed inline with the Labels. By default they are diplayed below…
any idea how i might achieve this?
thanks in advance.
From the form.css in every generated Yii app:
/**
* CSS styles for forms generated by yiic.
*
* The styles can be applied to the following form structure:
*
* <div class="form">
* <div class="row">
* <label for="inputid">xyz</label>
* <input name="inputid" id="inputid" type="text" />
* <p class="hint">hint text</p>
* </div>
* <div class="row">
* <label for="inputid">xyz</label>
* <input name="inputid" id="inputid" type="text" />
* <p class="hint">hint text</p>
* </div>
* <div class="row buttons">
* <label for="inputid">xyz</label>
* <input name="inputid" id="inputid" type="text" />
* <p class="hint">hint text</p>
* </div>
* </div>
*
* The above code will render the labels and input fields in separate lines.
* In order to render them in the same line, please use the "wide" form as follows,
*
* <div class="wide form">
* ......
* </div>
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright Copyright © 2008-2010 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
Please read the documentation, it also depends on what you are using, CHtml?, CActiveForm? CForm?
thanks for the reply,
i am using the default YII implementation… no idea which of the classes you’ve mentioned is the default one…
i am new to yii but i am loving it
Instead of <div class=“form”> use <div class=“wide form”>. You can also add a style into your css (div.form label { display: inline; }), but probably it won’t look as good as the first solution.
your hack worked for me andy_s. you’re a genius
Thanks…