From: "Andrea Bakker" on
Hi

I have recently installed the pear quickform component. I am trying to learn it, but have come across 2 problems.

1. When I hit submit (with valid data) , the screen goes blank - nothing displays

2. If I default to server side validation, when I hit submit, my screen comes up blank. No error messages are displayed.

I couldn't find a "quickform" forum under the packages.

Below is my simple code :

require_once 'HTML/QuickForm.php';

// Instantiate the HTML_QuickForm object
$form = new HTML_QuickForm('firstForm');

// Set defaults for the form elements
$form->setDefaults(array(
'adname' => ''
));

// Add some elements to the form
$form->addElement('header', null, 'QuickForm tutorial example');
$form->addElement('text', 'adname', 'Enter your name:', array('size' => 50, 'maxlength' => 255));
$form->addElement('select', 'categoryid', 'Choose a category:', $categorylist);
$form->addElement('submit', null, 'Send');

// Define filters and validation rules
$form->applyFilter('adname', 'trim');
$form->addRule('adname', 'Please enter your name', 'required', null, 'client');
//$form->addRule('adname', 'Please enter your name', 'required');

// Try to validate a form

if ($form->validate()) {
// Form is validated, then processes the data
//$form->freeze();
echo "the form is validated ";
$form->process('process_data', false);
}
else {
//$form->setDefaults($user);
$form->display();
}


function process_data ($values) {
echo "inside form process";
echo "<pre>";
foreach ($values as $key=>$value) {
echo $key."=".$value."<br>";
}
echo "</pre>";
}

?>

Any help would be appreciated
Thanks
Andrea
From: Alexey Borzov on
Hi Andrea,

Andrea Bakker wrote:
> I have recently installed the pear quickform component. I am trying to learn it, but have come across 2 problems.
>
> 1. When I hit submit (with valid data) , the screen goes blank - nothing displays

To make the screen display something, add the following to php.ini
error_reporting = E_ALL
display_errors = On

Also consider adding
PEAR::setErrorHandling(PEAR_ERROR_DIE);

after including HTML/QuickForm.php

I don't see any errors in the script you posted but it doesn't mean there aren't
any.

If you are just learning HTML_QuickForm, consider looking at HTML_QuickForm2
(preferrably at SVN trunk rather than 0.3.0), it isn't feature complete yet, but
we are working on it.
From: Christian Weiske on
Hello Andrea,


> 1. When I hit submit (with valid data) , the screen goes blank -
> nothing displays
Seems like a problem with your code (PHP fatal error).
Your server is probably configured to not display any errors to the
user/browser (display_errors Off). Either enable it or check your error
log.


Christian