Re: Extending HTML_QuickForms
| From: | Justin Patrin | Date: | Mon, 06 Dec 2004 03:35:54 +0000 |
| Subject: | Re: Extending HTML_QuickForms | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-34822@lists.php.net to get a copy of this message | ||
On Sun, 5 Dec 2004 16:02:29 -0800, Colin Ross <cross@worldstudygroup.com> wrote:
> This may sway into off-topic, if the pear-users list is better suited,
> let me know:
> But with that said... What the heck is the process method help with?
> I would think if i had a form with a process method, that would be to
> aid the PROCESSING (emailing it, inserting into a db, etc.)
> No offense, I love the QuickForm package, but just think that the
> process method is kinda useless for any-kind of post-processing.
> If its intent was for validating, that has been taken-care of by
> user-defined rules and filters. What can we really do with the $values
> array it passes offf that we can't with user-defined filters and rules.
I still don't understand why you need for form object in the first
place. The array given to you has all of the name/value pairs for the
form...
*I* Actually use DB_DataObject to do this kind of processing. I extend
the DB_DataObject class and alter the insert/update methods, the use
FormBuilder for the form.
>
> I am looking at eventually converting about 40 forms that either send
> emails, make webservice calls, insert in to db, etc.
> I was hoping to use the process call like a factory method, like so:
>
> $email_config[] = array ('to'->'webmaster@example.com',
> 'from'->$form$[_elements]['email_address']['value']);
>
> if ($form-process(str 'email',bol FALSE,array $email_config[]))
> header(Location: thankyou?form=request-info);
> }else{
> header(Location: thankyou?form=request-info&error);
> }
> function email (&form, $combine_uploaded, $email_config){
>
> $email = new FormEmail(&form, $combine_uploaded, $email_config);
> if ($email->complete){
> return TRUE;
> }else
> return FALSE;
> }
> class QuickFormEmailer extends QuickFormProcessor (&form,
> $combine_uploaded, $email_config){
> // emailing class code here...
> }
> class QuickFormProcessor(){
> // QuickForm Processor Abstract Class
>
>
> }
>
> -----Original Message-----
> From: Justin Patrin [mailto:papercrane@gmail.com]
> Sent: Saturday, December 04, 2004 8:17 PM
> To: Colin Ross
> Cc: pear-dev@lists.php.net
> Subject: Re: [PEAR-DEV] Extending HTML_QuickForms
>
> On Sat, 4 Dec 2004 18:02:10 -0800, Colin Ross
> <cross@worldstudygroup.com> wrote:
> > I am in the process of trying to extend the processing part of
> HTML_QuickForm to send an email of the submited values after validation.
> > This is very common on websites, a form that send the result via
> email.
> >
> > The only problem is that the process() method only has a values array
> of $name=>$value.
> >
> > Is there a way to specify what you want process to pass off?
> > If i could i would like the whole [_elements] array, if not the whole
> object (or reference to it) so even the configuration of the mail can
> co-exist with the QuickForms'
> >
> > From what I can tell, the process() method calls a function
> (user-define or not) as passes the $value array mentioned earlier, but
> nothing else (other than an optional argument for combining files),
> therefore, within any fuction here, the form object is out of scope.
> >
> > Any ideas? I don't want to hack the code unless absolutely
> neccesary...
> >
>
> Don't extend HTML_QuickForm maybe? Create your own code which gets the
> values from the form and passes that and the form object into your
> mailer function.
>
> --
> Justin Patrin
>
--
Justin Patrin