I followed his tutorial to create my own date composite element, but I wanted to use selects instead of text fields. I added 3 new methods to the element that returns the multiOptions for each of the selects:
My_Form_Element_Date#getMonthMultiOptions() My_Form_Element_Date#getDayMultiOptions() My_Form_Element_Date#getYearMultiOptions() I also add "setters" for each of those so I can specify what the options should be when creating the form. For example, sometimes I want years in the past (for date of birth) and sometimes I want years in the future (for scheduling events). When building the decorator, I then pulled the multiOptions from the element using those methods and used the formSelect() helper instead of formText(). You should be able to do the same thing to create your own "time" composite element. -- Hector On Sun, Apr 25, 2010 at 11:03 AM, Jigal sanders <[email protected]>wrote: > Hello everyone, > > I have been busy implementing my own custom time form element. And I asume > that I am not doing anything which is rocket science. Namely I am trying to > create a custom form element which I can use to enter times. It shoul look > like two dropdown boxes of which i can select the hours and minutes.The > seconds should be set default to 00 as they are not important. > > Now I have been trying various things and i have been pointend to Matthew > Weier O'phinney's tutorial over here http://bit.ly/bswioH about creating > composite form elements. I think he is doing over here exactly the same as I > do, just i want to use different form element's. > > My question is how would I be able to use this very same example but in > stead of using a date format I want to use it to set a time with the use of > select boxes. > > I would appreciate it very much if someone can give me directions. > > Kind regards, > > J. Sanders >
