Yii Framework Forum: id attribute and CHtml::label - Yii Framework Forum

Jump to content

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

id attribute and CHtml::label Rate Topic: -----

#1 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 04 November 2008 - 06:44 PM

Hi, I have this:

echo CHtml::label(Yii::t('demo', 'Nombre: '), 'nombre');
echo CHtml::textField('nombre', '', array('title'=>Yii::t('demo', 'Escriba su nombre')));


I get this:

[tt]line 9 column 116 - Info: reference to non-existent ID "nombre"[/tt]

If I do this:

echo CHtml::label(Yii::t('demo', 'Nombre: '), 'nombre');
echo CHtml::textField('nombre', '', array('id'=>'nombre','title'=>Yii::t('demo', 'Escriba su nombre')));


the XHTML code validates OK. Will I need to put 'id'=>'nombre' always in my input fields' options? IMHO it would be better if the id attribute rendered as the name attribute...  ::)
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,874
  • Joined: 04-October 08
  • Location:DC, USA

Posted 04 November 2008 - 09:13 PM

Done.
0

#3 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 05 November 2008 - 09:42 AM

Thanks Qiang!
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