Date:  03/13/2003 12:12:17 AM Msg ID:  001367
From:  FoxWeb Support Thread:  001363
Subject:  Re: (Novice) parameter question
Carl,
 
Your script is a little difficult to follow.  I think the most important thing would be to learn how to debug your programs, which will help you solve any problems you encounter.  The FoxWeb documentation lists a number of debugging techniques, which are applicable in different situations.
 
For example, it would probably be helpful to you if you added the following statement right after you read the values of mode and refno:
 
Response.Write('lmode=[' + M.lmode + ']<br>')
Response.Write('gRefNo=[' + M.gRefNo + ']<br>')
Response.Flush

Alternatively, you can display these values in your channel window, using the ? command.

Another useful technique is tracing through your programs, as described in the Troubleshooting chapter of the FoxWeb documentation.  The procedure is fairly simple:

As soon as execution hits the above statement, VFP will open the trace window and allow you to step through your code.
 
Regarding your question about passing parameters between procedures, the fwx file is converted to a regular VFP PRG file and from there to an FXP file.  All native methods work, including the use of private variables that are visible to procedures you call down the code (not recommended) and passing parameters (recommended).

FoxWeb Support Team
support@foxweb.com email

Sent by carl lofton on 03/11/2003 01:02:32 PM:
I've got a program that has 3 procedures a main procedure, a display and a save procedure.   I can't seem to figure out how to pass the value (reference number) selected from my main procedure into the other 2 procedures. 
 
 
here's my program:
 
m.lmode =PROPER(Request.item("mode"))
m.lgRefno = (Request.item("refno"))   //this is empty
DO CASE
 CASE m.lMode = "Mainform"
  DO MainForm
 CASE m.lMode = "Savedata"
  DO SaveData with m.lgrefno
 CASE m.lMode = "Survey"
  DO pSurvey WITH m.lgRefno
ENDCASE
 
 
PROCEDURE Mainform
%>
<BODY BGCOLOR=Turquoise>
<CENTER>
 
</HEAD>
<script>
function submitVal(varin) {
 if (varin=="Survey") {
  document.survey.mode.value = varin
  document.survey.submit()
 }
}
</SCRIPT>

<%
SELECT ;
 RefNo,;
 bd_Name,;
 bd_address,;
 Complete ;
  FROM (m.gDataPath+"PASSRV") ;
  INTO CURSOR Temp ;
  WHERE CasCode = m.gCasCode ;
  ORDER BY BD_name
m.lSrvRec = _TALLY
%>
<P>
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=6 WIDTH=500>
<TR ALIGN=LEFT>
<TD COLSPAN=2>
Please complete the survey form for each of the buildings listed below as
per the march "DATE" memorandum to all Court Unit Executives</A>.
<TR>
<TD ALIGN=CENTER>
<%
IF m.lSrvRec > 0
 %>
 <TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1>
 <TR><TD>
 <SELECT SIZE=10 NAME='refno'>
 <%
 SCAN
  Response.write("<OPTION VALUE="+RefNo+IIF(RECNO()=1," SELECTED","")+">"+TRIM(BD_Name)+" "+IIF(EMPTY(Complete),"(incomplete)","(completed)")+"</OPTION>"+CHR(13))
 ENDSCAN
 %>
 </SELECT>
 </TR>
 </TABLE>
 <P>
 <INPUT TYPE=button VALUE="Select" onClick=submitVal("Survey")> &nbsp;
 <%
ENDIF
%>
</TD>
<%m.gRefNo = Request.form("refno")%> ///??????
</TR>
<TR>
<TD>
Click here for <A HREF=/passrvhelp.htm#assistance>assistance and contact info</A>.
</TD>
</TR>
</TABLE>
<FORM name=survey action=/passrv.fwx method=POST>
<INPUT TYPE=hidden NAME=mode value="Survey">
<INPUT TYPE=hidden NAME=refno value=<%m.gRefno%>
<P>
<HR>
</form></body></html>
<%RETURN%>
 
<%PROCEDURE SaveData
m.gRefNo = Request.item("refno")
DO Survey WITH ;
  "PASSRV",;
  "OXGIMSX",;
  m.gRefNo,;
  .T.
Response.Write("</FORM></body></html>")
RETURN
%>
 
<% PROCEDURE pSurvey
PARAMETERS refno
m.gRefNo = Request.item("refno")

WAIT WINDOW "IN SURVEY PROCEDURE"
WAIT WINDOW m.gcascode + "" + m.grefno %>
<BODY BGCOLOR=Turquoise>
<FORM action=/passrv.fwx method="post">
<INPUT TYPE=hidden NAME=mode value="Savedata">
<% WAIT WINDOW m.gRefNo

DO Survey WITH ;
  "PASSRV",;
  "OXGIMSX",;
  m.gRefNo,;
  .F.
    
 RETURN
%>