Re: QuickForm, problem setting defaults on select
| From: | Ian Warner | Date: | Mon, 16 Oct 2006 03:43:17 +0000 |
| Subject: | Re: QuickForm, problem setting defaults on select | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25455@lists.php.net to get a copy of this message | ||
Louie Miranda wrote:
Hello, i tried to find first the archives and tried different settings to make it work. But could not. OK, here is what i have tested.. My code is..// Set defaults for the form elements $form->setDefaults( array( 'custom_name' => $custom_name, 'cc_account' => $cc_account, 'cc_type' => $cc_type, 'CCexpiry' => array('F'=>$cc_expm, 'Y'=>$cc_expy), ));Can you give me the values of all of the above please.
$type_of_account = array(""=>"", "Office"=>"Office",$type_of_account, $cc_account); You have 5 values in here - cant remember what the 5th does but do you need it?"Personal"=>"Personal"); $type_of_cards = array(""=>"", "VISA"=>"VISA", "MASTERCARD"=>"MASTERCARD", "AMEX"=>"AMEX");$form->addElement('text', 'custom_name', 'Custom Name', array('size' => 50,'maxlength' => 255, 'class' => txt_blk11px_b)); $form->addElement('select', 'cc_account', 'Type of Account', $type_of_account, $cc_account); $form->addElement('select', 'cc_type', 'Type of Card', $type_of_cards); $form->addElement('date', 'CCexpiry', 'Credit Card Expiration', array('format' => 'F-Y','minYear' => date('Y'), 'maxYear' => date('Y') + 10));$form->addElement('select', 'cc_account', 'Type of Account',
setDefaults, works on my input field custom_name and select CCexpiry. Now its weird that it does not work on field name cc_account and cc_type. The following $cc_account and $cc_type is just a single value (not array). Am i missing something here?