Re: FormBuilder and ajax integration?
| From: | Justin Patrin | Date: | Thu, 04 May 2006 22:10:18 +0000 |
| Subject: | Re: FormBuilder and ajax integration? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23942@lists.php.net to get a copy of this message | ||
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,-- Justin Patrin[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 xajaxandso far it has been going quite well. I have record navigationoptionsthat seem to be working, timestamp buttons (based on server times)andother 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 acompletedtable (to have ajax build wherever I want) based on all the regular formbuilder options and such, pretty much you just put in the tablefora blank form and a record id to populate the form with that records information. Now the problem is I want to save that information tothedatabase again, using the formbuilder's built-in validating if atallpossible... is there any way of using something like an array (whichIcan get from xajax) of values and then submitting them to bevalidated?I couldn't seem to find any documentation on this and I've beenlookingfor about 3 hours now. If anybody has any ideas I'd greatlyappreciateit. 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