Bug #19306 [Bgs]: cannot set default

From: Date: Sun, 26 Feb 2012 08:35:19 +0000
Subject: Bug #19306 [Bgs]: cannot set default
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-8327@lists.php.net to get a copy of this message
Edit report at https://pear.php.net/bugs/bug.php?id=19306&edit=1 ID: 19306 Updated by: borz_off@cs.msu.su Reported By: sergiokessler at gmail dot com Summary: cannot set default Status: Bogus Type: Bug Package: HTML_QuickForm2 Operating System: linux Package Version: 0.6.1 PHP Version: 5.3.2 Roadmap Versions: New Comment: In fact setDefaults() in QF1 worked exactly the same way. Good catch with setValue()! Please open a separate bug report for this, it will be easier to reference. Previous Comments: ------------------------------------------------------------------------ [2012-02-25 16:17:52] sak ok, I see I should write something like: $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array( 'new_row' => array('fecha' => array('d' => 5, 'M' => 5, 'Y' => 2011)), ))); hmm, I can see people coming from qf1 banging the head over the wall on this... also, it would be cool if I can chain the setValue, something like $form->addElement('date', 'new_row_fecha', $date_options) ->setLabel('Fecha:') ->setValue($date_defaults) ->addRule('required', 'Valor requerido') ; right now, that code throws error... should I put a feature request on this ? ------------------------------------------------------------------------ [2012-02-25 07:30:27] avb -Status: Open +Status: Bogus http://pear.php.net/manual/en/package.html.html-quickform2.values-datasources.php Read the part on "Implementations of HTML_QuickForm2_DataSource" until enlightenment. ------------------------------------------------------------------------ [2012-02-24 20:05:08] sak Description: ------------ $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array( 'new_row[fecha]' => array('d' => 1, 'M' => 1, 'Y' => 2011), ))); this does not work, is completely ignored, because the [] in the field name. (if I changue the fieldname without using [], it works) Test script: --------------- ... $form->addElement('date', 'new_row[fecha]', $date_options) ->setLabel('Fecha:') ->addRule('required', 'Valor requerido') ; ... $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array( 'new_row[fecha]' => array('d' => 1, 'M' => 1, 'Y' => 2011), ))); Expected result: ---------------- the date on screen should be updated Actual result: -------------- there is no default at all... ------------------------------------------------------------------------ -- Edit this bug report at https://pear.php.net/bugs/bug.php?id=19306&edit=1

« previous php.pear.bugs (#8327) next »