RE: [PEAR] FormBuilder and ajax integration?
| From: | Wright Zane A A1C 30 IS/DOMM | Date: | Fri, 05 May 2006 12:48:24 +0000 |
| Subject: | RE: [PEAR] FormBuilder and ajax integration? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-23958@lists.php.net to get a copy of this message | ||
Well I was able to use the setDefaults to get the form to populate, and
I was getting it from $_POST so I am not sure where the problem is... I
think I will just write a basic checker that looks at the _rules array
in the fb object (think that's right) and grab any that have the
'required' type. That at least will cover 95% of my rules. When I get
any completed code I'll try and post it on here. So far its looking
pretty darn slick... Thanks for all the help!
-----Original Message-----
From: Justin Patrin [mailto:papercrane@gmail.com]
Sent: Thursday, May 04, 2006 6:10 PM
To: Wright Zane A A1C 30 IS/DOMM
Cc: pear-general@lists.php.net
Subject: Re: [PEAR] FormBuilder and ajax integration?
On 5/4/06, Wright Zane A A1C 30 IS/DOMM <Zane.Wright@langley.af.mil>
wrote:
> When I output everything (have to use toHtml() instead of display()),
I
> just get a blank form, like its not pulling from the $_POST or $_GET?
I
> tried outputting html before and after the validate and it does the
same
> thing... blank form.
Are you sure that $_POST is getting set? You could also try using
setDefaults() on the form with the values from ajax.
>
> -----Original Message-----
> From: Justin Patrin [mailto:papercrane@gmail.com]
> Sent: Thursday, May 04, 2006 1:36 PM
> To: Wright Zane A A1C 30 IS/DOMM
> Cc: pear-general@lists.php.net
> Subject: Re: [PEAR] FormBuilder and ajax integration?
>
> On 5/4/06, Wright Zane A A1C 30 IS/DOMM <Zane.Wright@langley.af.mil>
> wrote:
> > I believe I am doing that, and still nothing. I've build everything
so
> > it goes in this order...
> >
> > Xajax sends the form data looking like... (based off of the liveuser
> > package names)
> >
> > $temp = array([handle] => username,
> > [authuserid] => 35);
> >
> > Which I then do as you suggested with $_POST = $_GET = $temp;
> >
> > Then I run another function that creates the do, fb stuff...
> >
> >
> > $do = DB_DataObject::factory($tablename);
> > $builder = DB_DataObject_FormBuilder::create($do);
> >
> > $form =& $builder->getForm();
> > if($form->validate()) {
> > 'good things happen here'
> > } else {
> > 'bad things happen'
> > }
> >
> > Always get the bad things.
> >
> > Am I missing something? I tested it to make sure the $_POST and
$_GET
> > were showing up in the other function... Thanks.
> >
>
> What is failing? Try $form->display() to see what validation is
failing.
>
> > -----Original Message-----
> > From: Justin Patrin [mailto:papercrane@gmail.com]
> > Sent: Thursday, May 04, 2006 1:05 PM
> > To: Wright Zane A A1C 30 IS/DOMM
> > Cc: pear-general@lists.php.net
> > Subject: Re: [PEAR] FormBuilder and ajax integration?
> >
> > On 5/4/06, Wright Zane A A1C 30 IS/DOMM <Zane.Wright@langley.af.mil>
> > wrote:
> > > Hello all,
> > >
> > >
> > >
> > > I have been working with integrating parts of formbuilder with
xajax
> > and
> > > so far it has been going quite well. I have record navigation
> options
> > > that seem to be working, timestamp buttons (based on server times)
> and
> > > other fun things like that. But I'm now trying to take it a step
> > > further...
> > >
> >
> > :-) sounds cool.
> >
> > >
> > >
> > > I have built a new form-generator front-end that spits out a
> completed
> > > table (to have ajax build wherever I want) based on all the
regular
> > > formbuilder options and such, pretty much you just put in the
table
> > for
> > > a blank form and a record id to populate the form with that
records
> > > information. Now the problem is I want to save that information to
> the
> > > database again, using the formbuilder's built-in validating if at
> all
> > > possible... is there any way of using something like an array
(which
> I
> > > can get from xajax) of values and then submitting them to be
> > validated?
> > > I couldn't seem to find any documentation on this and I've been
> > looking
> > > for about 3 hours now. If anybody has any ideas I'd greatly
> appreciate
> > > it. Thanks!
> > >
> >
> > Well...if you want things to be validated "by FB" then you have to
let
> > it build a QF. QF does the validation, not FB. To make that work all
> > you'd do it set your submitted values in $_POST and let QF read them
> > (this needs to be before the QF is created). Then you create and
> > process as normal with FB.
> >
>
>
> --
> Justin Patrin
>
--
Justin Patrin