Yii Framework Forum: Customize prefix in CActiveForm - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Customize prefix in CActiveForm Rate Topic: -----

#1 User is offline   Maaaks 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 07-May 12
  • Location:Moscow, Russia

Posted 04 July 2012 - 02:36 AM

Is there any way (or are there any plans to add a way in future releases) to make CActiveForm's name prefix customizable?

Currently, it uses get_class($model) to resolve input names, like MySuperModel[myInputName]. I would like to have an option to give a custom prefix instead of class name. Maybe it's a good idea to replace get_class($model) with something like $model->getFormPrefix()?

I need this for rendering multiple different models to one form: I want the models to be parts of an array. Inputs of the first model should be named like MySuperModel[1][myInputName], the inputs of the second one — like MySuperModel[2][myInputName], and so on.
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,357
  • Joined: 12-October 09
  • Location:Croatia

Posted 04 July 2012 - 02:39 AM

There is an issue on GitHub currently opened for this - https://github.com/y.../yii/issues/470
Find more about me.... btw. Do you know your WAN IP?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users