[phplib] load_defaults() From: T.R. Henigson (ted <email protected>)
Date: 08/19/00

I can't seem to get the load_defaults() method to do anything.
What's wrong in the following code? - if I type over the default
value of the text field and hit submit, the form returns with the
default value instead of the new value. How do I get load_defaults()
to work? Thanks,

Ted

<?

require("oohforms.inc");

$formvar=new form();

$formvar->add_element(array(
        'type'=>'text',
        'name'=>'fieldtest',
        'value'=>'default',
        'minlength'=>4,
        'maxlength'=>40,
        'valid_regex'=>'^[a-z]+$',
        'icase'=>1,
        'length_e'=>'Not long enough',
        'valid_e'=>'All letters, please'));

$formvar->add_element(array(
        'type'=>'submit',
        'name'=>'submitter',
        'value'=>'Enter'
        ));

if($submitter)
{
        if($err = $formvar->validate())
        {
                echo $err;
                $formvar->load_defaults();
        }
        else
        {
        /* Process data */
        }
}

$formvar->start();

$formvar->show_element('fieldtest');

$formvar->show_element("submitter","Enter");

$formvar->finish();

?>

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>