<% ' ' Customer Entry and Maintenance ' %> Customer3 " TYPE="text/css"> <% CheckFieldChange=oCustomer.call("get_peFieldMultiUser") %> <% ' DebugMode =1 ' uncomment this for page get/post debug help %>

Multi-Page Data entry Screen Example

<% ' ' This processes all GET and POST processes. ' If a GET we either need to display a record (which is passed ' in querystring) or clear the form. When a QueryString is passed ' it usually passed as an HREF from a report. This allows report line ' link to an entry form. ' ' If a POST one of the buttons was pressed and the data was posted ' back to itself. We must figure out what we are supposed to do ' (find, clear, save, delete, list) and do it. ' ' ' Note we will create and test the following variables ' Indx: The current selected index Indx = 1 CurrentPage = 1 If request("Request_method")="GET" Then ' if a GET see if a querystring Customer Rowid was passed. If it was ' we should find this record, else just clear the DDO RowId = request("RowId") If RowId <> "" Then ' this message is understood by the WebBusinessProcess01 class in VDF err = oCustomer.RequestFindbyRowId( "Customer", RowId ) If Err = 0 then CurrentPage = 2 else CurrentPage = 1 Else Err = oCustomer.RequestClear("Customer",1) End If else ' if here post request. We need to find out which submit button was ' pressed. Only the pressed button will be returned with the Post. So ' we can check to see if the button value exists (e.g. request("bname"). ' This will return the buttons text value IF it was pressed and return ' a blank if it were not pressed. So, if Request("bname")<>"" is was pressed if Request("clear")<>"" then Err = oCustomer.RequestClear("Customer",1) end if if Request("find")<>"" then Err = oCustomer.RequestFind("Customer", Indx, EQ) ' Find EQ if Request("next")<>"" then CurrentPage =2 err = oCustomer.RequestDDUpdate("Customer",0) if err then ' we only care if the error is one of the items on this page. We must check each ' item for an error here. FErr = oCustomer.DDValue("Customer.Customer_Number",DDFIELDERROR) if FErr = "" then FErr = oCustomer.DDValue("Customer.Name",DDFIELDERROR) if FErr = "" then FErr = oCustomer.DDValue("Customer.Phone_Number",DDFIELDERROR) if FErr <>"" then CurrentPage=1 Response.write("Errors exist on this page which must be corrected") end if end if end if if Request("back")<>"" then err = oCustomer.RequestDDUpdate("Customer",0) CurrentPage=1 end if if Request("save")<>"" then ' note that we can return a value here. err = oCustomer.RequestSave("Customer") if err = 0 then Response.Write("

Thank you for sending your information.

") CurrentPage=1 else Response.Write("

Could not save changes. Errors Occurred

") CurrentPage=2 end if end if if Request("validate")<>"" then err = oCustomer.RequestDDUpdate("Customer",0) if Err = 0 then Response.Write("

Current data is Valid

") else Response.Write("

Current data is not valid

") end if CurrentPage=2 end if end if %>
<% If Currentpage = 1 then %>
">

<% ' build table of input items for page 1 %> <%FieldError=oCustomer.DDValue("Customer.Customer_Number",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %> <%FieldError=oCustomer.DDValue("Customer.Name",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %> <%FieldError=oCustomer.DDValue("Customer.Phone_Number",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %>
<%=oCustomer.DDValue("Customer.Customer_Number",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.Customer_Number",DDAuto)%> <%=FieldError%>
<%=oCustomer.DDValue("Customer.Name",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.Name",DDAuto)%> <%=FieldError%>
<%=oCustomer.DDValue("Customer.Phone_Number",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.Phone_Number",DDAuto)%> <%=FieldError%>

<% else %>
<% CustRowId=oCustomer.DDValue("Customer.RowId") CustNum=oCustomer.DDValue("Customer.Customer_number") CustNam=oCustomer.DDValue("Customer.Name") CustPhn=oCustomer.DDValue("Customer.phone_number") %>

Previous Page

<% If CustRowId="" then %> Adding a New Customer
<% else %> Editing Customer Number <%=CustNum%>
<% end if %>

Customer Name: <%=CustNam%>
Customer Phone: <%=CustPhn%>

<%FieldError=oCustomer.DDValue("Customer.Address",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %> <%FieldError=oCustomer.DDValue("Customer.Status",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %> <%FieldError=oCustomer.DDValue("Customer.City",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %> <%FieldError=oCustomer.DDValue("Customer.State",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %> <%FieldError=oCustomer.DDValue("Customer.Zip",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %> <%FieldError=oCustomer.DDValue("Customer.Fax_Number",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %> <%FieldError=oCustomer.DDValue("Customer.Email_Address",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %> <%FieldError=oCustomer.DDValue("Customer.Credit_Limit",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %> <%FieldError=oCustomer.DDValue("Customer.Purchases",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %> <%FieldError=oCustomer.DDValue("Customer.Balance",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %> <%FieldError=oCustomer.DDValue("Customer.Comments",DDFIELDERROR) %> <% If FieldError<>"" then %> <% end if %>
<%=oCustomer.DDValue("Customer.Address",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.Address",DDAuto)%> <%=FieldError%>
<%=oCustomer.DDValue("Customer.Status",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.Status",DDAuto)%> <%=FieldError%>
<%=oCustomer.DDValue("Customer.City",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.City",DDAuto)%> <%=FieldError%>
<%=oCustomer.DDValue("Customer.State",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.State",DDAuto)%> <%=FieldError%>
<%=oCustomer.DDValue("Customer.Zip",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.Zip",DDAuto)%> <%=FieldError%>
<%=oCustomer.DDValue("Customer.Fax_Number",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.Fax_Number",DDAuto)%> <%=FieldError%>
<%=oCustomer.DDValue("Customer.Email_Address",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.Email_Address",DDAuto)%> <%=FieldError%>
<%=oCustomer.DDValue("Customer.Credit_Limit",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.Credit_Limit",DDAuto)%> <%=FieldError%>
<%=oCustomer.DDValue("Customer.Purchases",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.Purchases",DDAuto)%> <%=FieldError%>
<%=oCustomer.DDValue("Customer.Balance",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.Balance",DDAuto)%> <%=FieldError%>
<%=oCustomer.DDValue("Customer.Comments",DDLONGLABEL,1)%> <%=oCustomer.DDValue("Customer.Comments",DDAuto)%> <%=FieldError%>

<% end if %>