#INCLUDE WCONNECT.H
DEFINE CLASS MailingList AS rbPage
FUNCTION Page
This.oData = This.DataObject("Member","MemberID",[-1])
This.oData.MemberID = "NEW"
This.Content = This.MergeToString("MailingList.htm")
This.PageTitle = "Join Mailing List"
This.Merge("TemplatePage.htm")
ENDFUNC
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=_6WG0SV33J")
ELSE
This.Content = This.MergeToString("MailingList.htm")
This.PageTitle = "Join Mailing List"
This.Merge("TemplatePage.htm")
ENDIF
ENDFUNC
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
ENDDEFINE
csCodeParser v0.9 stats: 75 lines in 0.00 seconds.