Re: array on addElement, does not work => QuickForm
| From: | Louie Miranda | Date: | Mon, 16 Oct 2006 02:31:27 +0000 |
| Subject: | Re: array on addElement, does not work => QuickForm | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-243176@lists.php.net to get a copy of this message | ||
Ok thanks a bunch.
On 10/13/06, Ian Warner <iwarner@triangle-solutions.com> wrote:
Louie Miranda wrote: Now i know. Wow, this is really a great tool. Can i filter CCexpiry for month and year.. lets say if today is october 2006 and user selected may 2006 (where it should had been expired already). Can a rule be processed on that directly on quickform? So far the only rule i got was.. $form->addRule('CCexpiry', 'Please select credit card expiration', 'required', null); Probably I am not too hot on JavaScript. But basically you are saying if anything is below 200610 then error, that should be quite simple for a javascript guru to do, I looked at the Compare command but cant see how that would be used . http://pear.php.net/manual/en/package.html.html-quickform.intro-validation.php read here and see Louie On 10/13/06, Ian Warner <iwarner@triangle-solutions.com> wrote:-- Louie Miranda (lmiranda@gmail.com) http://www.axishift.com //JSM-WtwistLouie Miranda wrote:Whooa!? HAHA, it worked. Wow, thanks a lot. My brains started todidntonthis awhile ago. Yeah, that was my problem. I need to add the arrays together. LouieIts a good example actually of the power of quickform - now if youanyway,know the date functions then you probably have the month field a little different - combine these into one view the example here: http://wiki.triangle-solutions.com/index.php/PEAR_HTML_QuickForm#Date code for clarity - this will produce month and year select boxes, the key is the format - try and add Y-m-d H:i:s to this - very cool. $defaults['CCexpiry'] = array('m' => date('m') ); $form->addElement('date', 'CCexpiry', 'Credit Card Expiration', array('format' => 'F-Y',On 10/13/06, Ian Warner <iwarner@triangle-solutions.com> wrote:'minYear' => date('Y'), 'maxYear' => date('Y') + 10));Im trying to add an array of year from addElement, but couldnt getLouie Miranda wrote:wanted. My code below gets the current year and adds +10 to it and i loop it over an array of $numbers. // Get current year and add +10 more and display on the cc screen.what idate('Y')No need for all of that: QuickForm has it all: $form->addElement('date', 'cc_expy', 'Card Expiry (Year)', array('format' => 'Y', 'minYear' => date('Y'), 'maxYear' =>$date_year = date('Y'); $date_year_nx_7years = ($date_year + 10); foreach (range($date_year, $date_year_nx_7years) as $number) {$num_array = array($number=>$number); //$num_array++;}+ 10)); You problem was that you were overwriting you array each timelastBut when i try to display it over to addElement, i ony see theyou just had to add the arrays together. But use the above.$form->addElement('select', 'cc_expy', 'Card Expiry (Year)', $num_array); .. $form->toHtml()which is "2016". Not the full loop. Does anybody know, how can i get this to work? Thanks a lot.year