[FX.php List] Break up a big form

Jonathan Schwartz jonathan at eschwartz.com
Thu Jul 20 08:52:14 MDT 2006


Gjermund,

Thank you for the further explanation, Gjermund.

I had to stare at this for 10 minutes before getting an inkling what 
it did. Here's my take: Instead of breaking up large forms in an 
attempt reduce the amount of data flowing to the server, use this 
scripting to only send the data that had been changed.

Very interesting.  A couple of questions...

First Question: isn't this being evaluated by PHP on the Web Server 
after the all the data has been transmitted?  If this is the case, 
what is the advantage?  If this were done in Java, I could see the 
advantage.

Second Question:  While this would be fine for new record creation 
(no data entered in a field indicates no data needs to be forwarded 
to FMP), it would not appear to work in an editing page, where the 
user might be erasing data from a field that had been previously 
populated.  In that case, the field would not be updated by FMP. I 
suppose that a test could be added to handle this issue, but it seems 
to be getting further from the simpler solution of breaking up the 
form.

Thanks again for the suggestion.  Yet another eye-opener in the 
learning process.

Jonathan



At 10:52 AM +0200 7/20/06, Gjermund Gusland Thorsen wrote:
>If you follow my suggestion for a naming convention
>
>a for action
>s for submittable
>p for parsing required
>
>
>---
>
><input type="text" name="s[Name]" value="">
><input type="text" name="s[Address]" value="">
><input type="text" name="s[Phone]" value="">
><input type="submit" name="a" value="Update">
>
>---
>
>something like this would be valid
>---
>foreach( $_REQUEST['s'] as $key => $value ) {
>	if( $value != "" ) {
>		$q->AddDBParam( 'webSurvey'.$key, $value );
>	}
>}
>---
>and in this case insert whatever values you gave in the fields of 
>the form into
>the FileMaker fieldnames: webSurveyName, webSurveyAddress, webSurveyPhone
>
>On 7/20/06, Jonathan Schwartz <jonathan at eschwartz.com> wrote:
>>Gjermund,
>>
>>If this was intended for me, it's a little over my head at the
>>moment.  I'm still trying to do things in the most basic sense.
>>
>>Give me time.
>>
>>Thanks.
>>
>>
>>At 1:03 AM +0200 7/20/06, Gjermund Gusland Thorsen wrote:
>>>Did you ever consider to do something like this:
>>>
>>>foreach( $_REQUEST['s'] as $key => $value ) {
>>>        if( $value != "" ) {
>>>                $q->AddDBParam( 'webSurvey'.$key, $value );
>>>        }
>>>}
>>>
>>>ggt667
>>>
>>>On 7/20/06, Bob Patin <bob at patin.com> wrote:
>>>>Well, I think his whole question was how to best break up a
>>>>submission process into multiple forms. I do this when applications
>>>>involve a lot of fields, because in the past I've had to spend far
>>>>too much time with clients who said that they were receiving
>>>>applications with too many errors on them.
>>>>
>>>>So I always take big application systems, where the applicant has to
>>>>make a lot of decisions (meals, conference choices, card payment,
>>>>shuttles, etc.) and break them into multiple pages. My clients have
>>>>been much happier with this approach.
>>>>
>>>>I've noticed that a lot of large sites have gone to using multiple
>>>>forms with only a few questions on each page, rather than one huge
>>>>overwhelming form, which non-web savvy users always find very
>>>>intimidating.
>>>>
>>>>You could of course put ALL of it on one page, but for me that's just
>>>>too much information and code in one page. I'd rather have separate
>>>>HTML pages to work with, and because they're so tiny, the size is
>>>>totally irrelevant.
>>>>
>>>>Bob
>>>>
>>>>
>>>>On Jul 19, 2006, at 5:50 PM, Gjermund Gusland Thorsen wrote:
>>>>
>>>>>   Why not have all the communication with the database in one file?
>>>>>
>>>>>   CreateRecord.php for example..
>>>>>
>>>>>   ggt667
>>>>>
>>>>>   On 7/20/06, Bob Patin <bob at patin.com> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>   OK. Here I go, breaking up a large form into several pages.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>   Form1.php calls CreateRecord.php through a submit button.
>>>>>>
>>>>>>   CreateRecord creates the record...and now I need to call form2.php.
>>>>>>
>>  >>>>  (Previously, a review page was displayed, which handled the whole
>>>>>>   form).
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>   That's where I'm perplexed.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>   Do I use an include(Form2.php) on the bottom of the
>>>>>>   CreateRecord.php page,
>>>>>>   just after the FMNew function?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>   Or, do I open a Form2.php as a whole new page?  If so, I can't
>>>>>>   figure out
>>>>>>   which function does that, versus simply including on existing page.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>   Sorry for basic question.
>>>>>>
>>>>>>   No problem; everyone started in the same spot...
>>>>>>
>>>>>>   I process the 1st form in the 2nd page, which is also the
>>>>>>   submission page,
>>>>>>   part 2...
>>>>>>
>>>>>>   So the PHP at the top creates the NEW record, then immediately
>>>>>>   uses those
>>>>>>   same variables which I've captured from page 1, and plugs them
>>>>>>   into page 2,
>>>>>>   if you want the applicant to see them. For example, if page 2
>>>>>>   should show
>>>>>>   the stuff they entered into page 1, and then adds some more input
>>>>>>   fields,
>>>>>>   this makes it really easy to do that.
>>>>>>
>>>>>>   You can use IF statements to make it so that if there's an error,
>>>>>>   a line of
>>>>>>   error text shows up, like this:
>>>>>>
>>>>>>   if ($newResult['errorCode']==0){
>>>>>>
>>>>>>   <<< here's the 2nd form's fields >>>
>>>>>>
>>>>>>   }else{
>>>>>>
>>>>>>   echo "There was an error, yada yada yada.";
>>>>>>
>>>>>>   }
>>>>>>
>>>>>>   Hope that helps,
>>>>>>
>>>>>>   Bob Patin
>>>>>>   Longterm Solutions
>>>>>>   bob at longtermsolutions.com
>>>>>>   615-333-6858
>>>>>>   http://www.longtermsolutions.com
>>>>>>
>>>>>>     CONTACT US VIA INSTANT MESSAGING:
>>>>>>        AIM or iChat: longterm1954
>>>>>>        Yahoo: longterm_solutions
>>>>>>        MSN: tech at longtermsolutions.com
>>>>>>        ICQ: 159333060
>>>>>>
>>>>>>
>>>>>>
>>>>>>   _______________________________________________
>>>>>>   FX.php_List mailing list
>>>>>>   FX.php_List at mail.iviking.org
>>>>>>   http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>>>
>>>>>>
>>>>>>
>>>>>   _______________________________________________
>>>>>   FX.php_List mailing list
>>>>>   FX.php_List at mail.iviking.org
>>>>>   http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>
>>>>_______________________________________________
>>>>FX.php_List mailing list
>>>>FX.php_List at mail.iviking.org
>>>>http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>
>>>_______________________________________________
>>>FX.php_List mailing list
>>>FX.php_List at mail.iviking.org
>>>http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>>--
>>
>>Jonathan Schwartz
>>Schwartz & Company
>>817 Marin Drive
>>Mill Valley, CA 94941
>>Phone: 415-381-1852
>>jonathan at eschwartz.com - http://www.eschwartz.com
>>
>>_______________________________________________
>>FX.php_List mailing list
>>FX.php_List at mail.iviking.org
>>http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>_______________________________________________
>FX.php_List mailing list
>FX.php_List at mail.iviking.org
>http://www.iviking.org/mailman/listinfo/fx.php_list


-- 

Jonathan Schwartz
Schwartz & Company
817 Marin Drive
Mill Valley, CA 94941
Phone: 415-381-1852
jonathan at eschwartz.com - http://www.eschwartz.com



More information about the FX.php_List mailing list