开发者

Need to apply a css class to all textfields using Zend Framework

开发者 https://www.devze.com 2023-04-09 21:48 出处:网络
I\'m doing some bit of redesigning here for which we hired an outsourced freelance designer. He sent in the designs however he\'s used css class styles for the textboxes as opposed to my earlier attem

I'm doing some bit of redesigning here for which we hired an outsourced freelance designer. He sent in the designs however he's used css class styles for the textboxes as opposed to my earlier attempts to apply a ganeral style to the inputs tag which had its hiccups.

I've used the Zend View Helpers to create the textboxes howeve开发者_Python百科r I would like a simpler way to be able to set it up so by default all textfields would have the base css class 'textfield' - is there a way to do so in code without me having to explicitly make the addition in every call made to the view helper?


If you want to apply this style to all textfields on your page you just need a general textfield style and there is no need to even touch your markup.

If you have other textfields as well which you want to style differently, you will have to either extend Zend_Form, Zend_Form_Element or Zend_Form_Element_Text. Probably it would be easiest to extend the former and adding an attribute 'class' with the value 'textfield' to every text element while looping through all form elements.

But again. Why would you need to touch your markup at all, you just need a style for textfields.

0

精彩评论

暂无评论...
验证码 换一张
取 消