Multiple Attributes For Activetextfield

Hi Guys,

Just wondering how I can have multiple attributes for an activeTextfield?

For example, instead of:




<input size="30" maxlength="30" name="Question[SOME_ID]" id="Question_FLAG" type="text">



I want:




<input size="30" maxlength="30" name="Question[SOME_ID][FLAG]" id="Question_FLAG" type="text">



Is it possible?




echo $form->textField($answer,'SOME_ID',array('size'=>30,'maxlength'=>30));



I tried an array of attributes but it wouldn’t accept it.

Thanks!

Please give more specific details and what exactly you want to do

I’d like to have multiple array attributes that are fed from variables in the name field:




name="Question[SOME_ID][FLAG]"



For example:




name="Question[1234][5]"



At the moment I can only work out how to do this:




name="Question[1234]"



Have you tried


 echo $form->textField($answer,'[SOME_ID]FLAG',array('size'=>30,'maxlength'=>30));

Yii provides the names of field with specific way to manipulate the data of user for each field.

Why you want to have multiple attributes in the name field?

If you want extra data for input or any other tag you can use data-nameofattribute="value" inside of tag like class , id etc (html5)

As far as I know, it helps for tabular input (although I wouldn’t have called them “multiple attributes”)

Thanks guys… In the end I gave up and converted to CHTML:




CHtml::textField($name.'['.$id.']['.$flag.']',$answer->FLAG,array('size'=>30,'maxlength'=>30));