[FX.php List] One Button, two forms/scripts?

Micah Desjardins Micah.Desjardins at asu.edu
Fri Oct 7 12:53:08 MDT 2005


Yet another option:

Keep the two forms, but send them to the same form handler page.
Add a hidden input to distinguish the type of action you would like performed

Evaluate what inputs are passed on the form handler page and then process accordingly.

--
Micah DesJardins


> ----------
> From: 	fx.php_list-bounces at mail.iviking.org on behalf of Marisa Smith
> Reply To: 	FX.php Discussion List
> Sent: 	Friday, October 7, 2005 4:15 AM
> To: 	FX.php Discussion List
> Subject: 	Re: [FX.php List] One Button, two forms/scripts?
> 
> Jonathan - you can also use Javascript to submit the form and switch the php
> response page by passing a different action parameter to the form.
> 
> In this case, you would only have ONE form on your page (Note the name value
> I added to make it easier to refer to in the javascript- you can use
> whatever you want here, just be sure to pass it in the link below):
> 
> <form method="post" action="edit_response.php" name="myform">
> <input type="hidden" name="recid" value="<?php echo $recid; ?>">
> <input type="image" name="refresh"  src="images/refresh.gif">
> </form>
> 
> 
> Your buttons (I usually use links) would look like this:
> <a href="javascript: goSave(document.myform, 'edit_response.php');">Save &
> Refresh</a>
> 
> <a href="javascript: goSave(document.myform, 'approve.php');">Save &
> Continue</a>
> 
> 
> Finally, put a javascript in your header that looks like this:
> <script type="text/javascript">
> //function for changing the standard page displayed after submitting
> function goSave(theForm,theResponsePage)
>     {
>     theForm.action = theResponsePage;
>     theForm.submit();
>     }
> </script>
> 
> In this manner, you can have more than one button/link on a page than lands
> you in different places, but always submits the form first.
> Marisa
> 
> On 10/06/2005 9:13 PM, "Jonathan Schwartz" <jonathan at eschwartz.com> wrote:
> 
> > Hello.
> > 
> > I have an edit page (edit.php) where users fill in a form, click a
> > refresh button which loads edit_response.php to save the data,
> > leaving the user on the original edit page to continue editing.  When
> > they want to leave, they click a separate button (continue), which
> > delivers them to a thank you page. No processing...just display of
> > data.
> > 
> > The problem....users who edit and click continue (skipping the step
> > which saves the data on edit_response, lose their data.  I have tried
> > to use a warning note, asking users to click refresh button before
> > leaving...but that fails the ultimate test...the Melanie test.
> > Melanie is my wife. ;-)
> > 
> > To the question.  How do I have the Continue button run the
> > edit_response script before heading to the Thank you exit screen.  I
> > would still kep the Refresh button.
> > 
> > Here is the code for the two buttons:
> > 
> > <form method="post" action="edit_response.php">
> > <input type="hidden" name="recid" value="<?php echo $recid; ?>">
> > <input type="image" name="refresh"  src="images/refresh.gif">
> > </form>
> > 
> > 
> > The Thank you/Exit button:
> > 
> > <form method="post" action="approve.php">
> >    <input type="hidden" name="recid" value="<?php echo $recid; ?>" />
> >    <input type="image" name="approve" border="0"
> > src="images/buttoncontinue.gif">
> > </form>
> > 
> > Thanks!
> > 
> > Jonathan
> > _______________________________________________
> > FX.php_List mailing list
> > FX.php_List at mail.iviking.org
> > http://www.iviking.org/mailman/listinfo/fx.php_list
> > 
> > 
> 
> ---------------------------------------------------------------------
> Marisa Smith, President
> DataSmith Consulting, LLC
> 9206 Huron River Drive
> Dexter, MI 48130
> Phone: (734) 426-8077
> Fax: (734) 426-7069 - NEW!
> http://www.datasmithconsulting.net
> Filemaker Solutions Alliance Associate Member
> 
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org> 
> http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> 


More information about the FX.php_List mailing list