Zendcasts Forum

A community of developers who work with the Zend Framework and other enterprise PHP technologies

You are not logged in.

#1 2010-03-11 04:14:21

Jon Lebensold
Administrator
Registered: 2009-06-27
Posts: 279

ZC49 – Writing Composite Zend_Form Elements

This video should help you build your own composite Zend_Form element. We'll be building a phone element. The phone element will have 3 textboxes, one for geographic location, area code and local code. In the following videos will add a custom cell phone validator and some ajax validation.

Grab a copy of the project or browse the repository.

Offline

#2 2010-04-12 12:15:38

zaherg
New member
From: Damascus , Syria
Registered: 2010-04-11
Posts: 6
Website

Re: ZC49 – Writing Composite Zend_Form Elements

Hi:
here is my code and how i made a composite form element for the Date Of Birth

http://pastie.org/915510

the code my not be as good as you might think , but we are all learning something new everyday big_smile

thanks

Offline

#3 2010-04-12 15:55:31

Jon Lebensold
Administrator
Registered: 2009-06-27
Posts: 279

Re: ZC49 – Writing Composite Zend_Form Elements

Hi Zeherg,

thanks for mentioning this!

Offline

#4 2010-04-12 17:25:07

zaherg
New member
From: Damascus , Syria
Registered: 2010-04-11
Posts: 6
Website

Re: ZC49 – Writing Composite Zend_Form Elements

your most welcome ..
i hope that you can make a cast about how to create a composite form element other than text since its ( text elements ) already mentioned in other places.

Offline

#5 2010-05-11 12:38:19

zaherg
New member
From: Damascus , Syria
Registered: 2010-04-11
Posts: 6
Website

Re: ZC49 – Writing Composite Zend_Form Elements

hi :
i just want to put a note that you have not to use

$this->html

in your code instead you will have to use the

$html 

.
other wise if you have 2 elements it will be rendered as 3 elements since that

$this->html

will not be reset for the next element ..

check my code since i have just made the changes ..
http://pastie.org/915510

regards

Offline

#6 2010-06-18 06:26:46

Oliver
New member
Registered: 2010-06-18
Posts: 1

Re: ZC49 – Writing Composite Zend_Form Elements

Hi Jon,

it looks like, the helper is only instantiated once. So if you use $this->html, to store the generated html-code, and append new html-code, every time a new element is added to the form, the new html-code will be appended to the previous. That is, what zaherg worte a few days before.

And btw: thank you, Jon, for your great zend tutorials!

Oliver

Offline

#7 2010-06-18 15:57:57

Jon Lebensold
Administrator
Registered: 2009-06-27
Posts: 279

Re: ZC49 – Writing Composite Zend_Form Elements

Hi Oliver, very good point! I missed that when I put together that helper.

Offline

Board footer

Powered by FluxBB