Dynamic Text fields in yii 1

I’m very new to yii framework( :( ). I want to create dynamic text fields.

e.g: if I click on + sign then it shows a NEW text field and then those values are inserted into database.

thanx in advance

Good morning Tilak morning welcome to YII, your problem solve with Jquery, When The user send the event a function Jquery receive the parameter and add the new field in your view, for add in the BD, the attribute would exist and in your view hidden.

I hope to help you!

Hi Tilak

If you want to insert multiple records you have to generate by javascript inputs with name "YourModel[theAtrribute1][]"

OR

if there are limited (for example max 10) you could generate 10 inputs named "YourModel[theAtrribute1][]" and hide by css (display:none) the last 9 and when click "add" button will show by javascript (CSS display:block) the next hidden one.

check also this wiki

http://www.yiiframework.com/wiki/805/simple-way-to-implement-dynamic-tabular-inputs/