Date:  05/03/2004 07:01:53 PM Msg ID:  002011
From:  FoxWeb Support Thread:  002010
Subject:  Re: Changing Form values after the fact
My favorite method to solve this problem is to modify widget_edit.fwx, so that after saving, it calls widget_show.fwx with the ID as an argument:
 
... Save the widget record
Server.Transfer('widget_show.fwx', M.widgetid)
 
Widget_show itself would contain something like this:
 
LPARAMETERS widgetid
IF PCOUNT() < 1
    M.widgetid = Request.Form('id')
ENDIF
... display the widget record
 

FoxWeb Support Team
support@foxweb.com email

Sent by David Hempy on 04/30/2004 04:47:38 PM:
 
I'm finally sinking my teeth into FW v.2 and using single .asp-style .fwx scripts for every little function.  Most of my v1.29 pages come from monolithic .prg files that serve dozens of different pages.  So far, the new approach feels very comfortable.
 
I'm working up a model fairly similar to the ContactMine appliaction.  I've got several scripts for managing widgets:
 
widget_list.fwx
widget_show.fwx
widget_edit.fwx
widget_save.fwx
 
A user working with widgets would generally progress through the pages in the order shown above.
 
My question resolves around widget_save.fwx.  They get here by submitting a <form action="widget_save.fwx" method="post">.
 
widget_save.fwx should have no output (assuming no errors occur).  It should perform a update or insert and then divert to widget_show.fwx via Server.Transfer() or Server.Execute().  (I specifically want to avoid a Response.Redirect() in this case)
 
In the case where the user is creating a new widget, Response.Item('id') will have a value of 0 (zero).  I won't know what the id (primary key) of the new widget is until I do the insert.  However, I'd like to have widget_show.fwx continue to get that value from Response.Item('id') to keep it as simple as possible.
 
What I would like to do is set the value of Response.Form('id') in widget_save.fwx before passing control off to widget_show.fwx.  It would be great if I could call something like: Response.FormSet('id', m.new_id).  Is there any way to accomplish this? 
 
Back in v1.29, I would change the CGIfields array manually.  I was nervous that it would bite me in the ass one day, but so far, so good.  ;-)
 
If this is not possible, does anyone have suggestions on other approaches to do this?  I'm a bit fuzzy on how VFP handles private/public vars across scripts and such, but I'm guessing I can find some combination to pass vars around. 
 
Thanks in advance,
-dave
 
 
 
 
--
David Hempy
Internet Database Administrator
Kentucky Educational Television
(859)258-7164  -  (800)333-9764