Yii Framework Forum: Placeholder for form elements - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Placeholder for form elements Rate Topic: -----

#1 User is offline   nickcv 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 154
  • Joined: 23-November 10

Posted 09 April 2011 - 04:26 AM

with the last release of Firefox 4 out of 5 of the major browser support this html feature.

can we have full support in yii too?
the ideal implementation would be to have a new method inside models to set the placeholder (just like we do now for labels) and when the form element is created it looks into the model to fill the placeholder attribute.
sometimes it's just like teaching pigs how to fly

Posted Image
Posted Image looking for some invite keys? welcome on B4K!
0

#2 User is offline   acorncom 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 102
  • Joined: 25-February 11
  • Location:CO, USA

Posted 28 April 2011 - 12:19 PM

Just looked into this. You can currently do this for your text field:
<?php echo $form->textField($model,'attribute',array('size'=>60,'maxlength'=>255,'encode'=>false,'value'=>'','placeholder'=>'Placeholder content')); ?>


Which is pretty slick.
2

#3 User is offline   nickcv 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 154
  • Joined: 23-November 10

Posted 28 April 2011 - 12:25 PM

yeah i know... but it's not really good when you have to do it N times across the application... i was hoping, since its becoming a standard, to have it better integrated o.o
sometimes it's just like teaching pigs how to fly

Posted Image
Posted Image looking for some invite keys? welcome on B4K!
0

#4 User is offline   johnsnails 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 77
  • Joined: 05-September 11
  • Location:Sydney Australia

Posted 28 November 2013 - 12:25 AM

View Postnickcv, on 28 April 2011 - 12:25 PM, said:

yeah i know... but it's not really good when you have to do it N times across the application... i was hoping, since its becoming a standard, to have it better integrated o.o


Just wondering what you mean by integrated? As in can be created say via a DB?
0

#5 User is offline   Shahcheraghean 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 478
  • Joined: 12-December 12
  • Location:Mashhad, IRAN

Posted 28 November 2013 - 01:15 AM

In place holder maybe there are some tips, suggestions, rule details etc. You have to hold them some where like db or make them from something.
That's a good idea, if it made up of rules() in model class.
www.shgn.ir
www.shgn.ir/yii-framework/
yii2.swsco.ir
In a world without any fences or walls,Who needs Gates or Windows!
0

#6 User is offline   Tirta Lalondong 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 20-April 14

Posted 22 April 2014 - 07:52 AM

View Postacorncom, on 28 April 2011 - 12:19 PM, said:

Just looked into this. You can currently do this for your text field:
<?php echo $form->textField($model,'attribute',array('size'=>60,'maxlength'=>255,'encode'=>false,'value'=>'','placeholder'=>'Placeholder content')); ?>


Which is pretty slick.


Thanks man :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

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