Web Connect How To : Show Me the Code!

 LAFOX Home How URL Maps to Code  LAFOX Design Oveview  Framework Extensions 
*Mailinglist.prg #INCLUDE WCONNECT.H ************************************************************* DEFINE CLASS MailingList AS rbPage &&WWC_PROCESS ************************************************************* ********************************************************************** ** Page() - PUBLIC - ** show a blank page for data input ********************************************************************** FUNCTION Page This.oData = This.DataObject("Member","MemberID",[-1]) && Blank Data Object This.oData.MemberID = "NEW" This.Content = This.MergeToString("MailingList.htm") This.PageTitle = "Join Mailing List" This.Merge("TemplatePage.htm") ENDFUNC &&MailingListJoin ********************************************************** ** Submit() - PUBLIC - ** If it Validates, return user to MeetingList ** If not, then show page again with errors ********************************************************** FUNCTION Submit This.oData = This.ReadForm("Member","MemberID") IF this.Validate(This.oData) This.Save("Member","MemberID",This.oData) This.WaitWindow("Record Saved!", "/Home.Page.fox?SessionID=_72A1068MC") ELSE This.Content = This.MergeToString("MailingList.htm") This.PageTitle = "Join Mailing List" This.Merge("TemplatePage.htm") ENDIF ENDFUNC &&Submit ************************************************************************ ** Helper Functions below ************************************************************************ ********************************************************** ** Validate() ** Return .F. if Validation fails ** tcError Passed by Reference ** Be sure to put <br> between errors ********************************************************** HIDDEN FUNCTION Validate(toData) LOCAL llRetval STORE .T. to llRetval IF EMPTY(toData.FirstName) This.AddError([Must Have First Name!]) llRetval = .F. ENDIF IF EMPTY(toData.LastName) This.AddError([Must Have Last Name!]) llRetval = .F. ENDIF IF EMPTY(toData.EMail) This.AddError([Must Have Email Address!]) llRetval = .F. ENDIF RETURN llRetval ENDFUNC &&Validate ENDDEFINE && MailingList
csCodeParser v0.9 stats: 75 lines in 0.00 seconds.