This is the application code. For clarity, all error handling has been removed.
Subroutine myapp Include wbp w3Include ;* required Err = "" ;* contains error value from w3Input Sub1="" ;* contains substitutions for the header Sub2="" ;* contains substitutions for the body * Housekeeping: open files and read and lock the data record. * Once locked, others cannot update the data record until * the data record is unlocked. New = 0 Open "Mydata" to fv else New = 1 |
Execute "create-file Mydata 1 1" Open "Mydata" to fv else stop 201 End If New = 1 then write "first" on fv, 1 Readvu item from fv, 1,1 else stop ;* read & lock the rcd being modified Call w3HtmlInit("Myapp","") ;* set the heading and footing * set up the substitution array for the header Sub1<1,1> = "##TITLE##" Sub1<1,2>="FlashConnect event driven application" Sub1<2,1>="??HEADLINE??" Sub1<2,2>="FlashConnect event driven application" |
Call w3HtmlHeader("",Sub1) ;* perform the substitution Call w3HtmlFormBeg("","") ;* start a form * setup the substitution array for the body, * then insert it into the Web page Sub2<1,1> = "!!VALUEHERE!!" Sub2<1,2>=item call w3HtmlInsertSection("Myapp.body", Sub2,”SECTION”) call w3HtmlFormEnd ;* End the form call w3HtmlFooter("","") ;* move the footing into the Web page, * no substitutions |
call w3Input(Err, 120, "") ;* send the Web page and * wait for a response * code continues here after a timeout or the user submits a reply if Err = w3_OK then ;* verify no errors * get the value returned by the user, reuse the item variable call w3GetVal(item, "USERSSTRING") * write the new value back into the database and release the record lock writev item on fv, 1, 1 end else * process the error release fv, 1 |
end close fv return This HTML code is sent to the browser. However, the hidden values for w3SessionId and w3InputPromptNumber may vary from the values shown here. <HTML><HEAD> <TITLE>MyApp title</TITLE></HEAD> <BODY BGCOLOR=white> <H1 ALIGN=CENTER>A simple FlashConnect demonstration</H1> <form action="http://w3lib.rainingdata.com/cgi-bin/ fccgi.exe"> |
<input type="hidden" name="w3SessionId" value="00011660336179"> <input type="hidden" name="w3InputPromptNumber" value="1"> String: <INPUT TYPE="TEXT" NAME="USERSSTRING" VALUE="1" SIZE="30"> <BR><INPUT TYPE="SUBMIT" VALUE="SUBMIT"> </form> <HR> <CENTER> Please contact us at: www.rainingdata.com </CENTER></BODY></HTML> |
See Also