QuickForm Issue with Default Values
| From: | James 'Chip' Kaufman | Date: | Wed, 22 Oct 2003 15:48:25 +0000 |
| Subject: | QuickForm Issue with Default Values | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-8542@lists.php.net to get a copy of this message | ||
I have multiple php pages in my app. The user enters some data and the
next page displays results. The user enters more data, and on to the
next page, etc.
The problem I am having is that some data displayed on page two is
incorrect. As an example, page 1 contains two select fields ('recordno'
and 'requestno') and a text field ('requestno2') that is used to
quickly enter a value w/o using the drop down menu. The app on page 2
uses the value in 'requestno2' if it exists. Otherwise, it uses the
value from 'requestno' or 'recordno'. Here is a partial dump of my
form:
html_quickform Object
(
[_elements] => Array
(
)
[_jsPrefix] => Invalid information entered.
[_jsPostfix] => Please correct these fields.
[_defaultValues] => Array
(
[recordno] => 1093
[requestno] => TSG0887
[sub_date] => 2003-06-05 18:47
)
[_constantValues] => Array
(
)
[_submitValues] => Array
(
[recordno] => 0
[requestno] => TSG0871 NOTE: From drop down menu
[requestno2] => tsg0887 NOTE: Manually entered by user
[action] => Next
)
)
You can see that I have set default values for 'recordno' and
'requestno'. Yet, when I display my form, what I see for recordno and
requestno are the values from the _submitValues array. (0 and TSG0871,
respectively).
Here is the code snippet from page 2:
$form = new HTML_QuickForm('appreq2', 'POST');
$defaults['recordno'] = $recordno;
$defaults['requestno'] = $requestno;
$form->setDefaults($defaults);
$form->addElement ('text', 'recordno', 'Record#');
$form->addElement ('text', 'requestno', 'Request#');
These are my installed packages:
===================
Package Version State
Archive_Tar 1.1 stable
Auth 1.2.2 stable
Cache_Lite 1.1 stable
Console_Getopt 1.0 stable
DB 1.5.0RC2 stable
Date 1.3.1beta beta
File 1.0.3 stable
Gtk_VarDump 0.1 beta
HTML_Common 1.2.1 stable
HTML_Menu 2.0pl1 stable
HTML_QuickForm 3.1.1 stable
HTML_Template_Flexy 0.4.2 beta
HTML_Template_Sigma 1.0.1 stable
HTTP 1.2.1 stable
Log 1.7.1 stable
MDB 1.1.3 stable
Mail 1.1.2 stable
Net_SMTP 1.2.3 stable
Net_Socket 1.0.1 stable
PEAR 1.1 stable
PEAR_Info 1.0.6 stable
Validate 0.2.0 alpha
XML_Parser 1.0.1 stable
XML_RPC 1.0.4 stable
apd 0.4p2 stable
--
James 'Chip' Kaufman
jkaufman@wamnetgov.com
952-346-3532
PGP key: 697D43DE