Re: Re: setting Flexy form error messages

From: Date: Mon, 01 Dec 2003 16:27:49 +0000
Subject: Re: Re: setting Flexy form error messages
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9245@lists.php.net to get a copy of this message
Demian Turner wrote:
Hi Alan thanks for the tip, i tried the following from your example code and it worked fine: $this->elements['input']->setValue('Hello'); HTML_Template_Flexy_Factory::setRequired($this->elements, array('input' => 'There was an error with input'));
I think this may be removed.. - it doesnt work very well.. - and doesnt make much sense.. try using $element->suffix, or just put the required flag in the template...
on a different tack, what do you think of a global ini setting to disable parsing of forms altogether, allowing the developer to handle forms independently without inserting flexy:ignore each time.
This kind of made precompiling templates rather messy. (but I still may consider it..)
currently with the 'elements' approach i have to use quite a lot of code to pre-check boxes: require_once 'HTML/Template/Flexy/Element.php'; $input->flexyElements['section[is_enabled]'] = ($input->section->is_enabled) ?
    new HTML_Template_Flexy_Element('input', array('checked' => true)) :
    new HTML_Template_Flexy_Element('input', false);
Assuming the HTML is <input type="checkbox" name="xxxx" value="3"> $input->flexyElements['xxx'] = new HTML_Template_Flexy_Element; $input->flexyElements['xxx']->value=3; should be enough.. OR <input type="checkbox" name="xxxx[]" value="1"> <input type="checkbox" name="xxxx[]" value="2"> <input type="checkbox" name="xxxx[]" value="3"> <input type="checkbox" name="xxxx[]" value="4"> $elements = new HTML_Template_Flexy_Factory::fromArray( array('xxxx' => array(1,3,4)); should work in the cvs code.. Regards Alan

« previous php.pear.general (#9245) next »