wwShowCursor::EditRecord

This method displays all fields of the table in editboxes for editing. The name of the HTML field matches the field name so you can retrieve any results with Request.Form("FieldName").

This method creates only the table with the fieldlist inside of it, it does not generate the HTML Form and submit button - you can wrap those around with Response writes as follows:

o.EditRecord(lnDisplayMode,lcObjectName)                   

Return Value

nothing - call GetOutput() to retrieve the generated HTML

Parameters

lnDisplayMode
Optional - default 0
0 - Generates with the data of the current record
2 - Generates ASP style tags with fieldnames attached to an object name. Example: <%= oCust.Company %> where 'oCust' is the value passed as lcObjectName.

lcObjectName
Optional - The name of the object or cursor that is used for ASP style tag when lnDisplayMode = 2. The default is the name of the ALIAS() selected.

Example

* wwDemo::EditRecord
Function EditRecord

lcAction = Request.QueryString("Action")
lcCustNo = PADL(ALLTRIM(Request.QueryString("CustNo")),8)

IF !USED("tt_cust")
   USE TT_CUST IN 0
ENDIF

SELE TT_CUST

IF EMPTY(lcCustNo)
   THIS.ErrorMsg("No Customer Number to edit",;
                 "Please enter a customer ID to edit")
   RETURN
ENDIF
    
LOCATE FOR CUSTNO = lcCustNo
IF !FOUND()
   THIS.ErrorMsg("No Customer Number to edit","Please enter a customer ID to edit")
   RETURN
ENDIF

pcMessage = ""

Response.HTMLHeader("Customer Editing")

*** We're now on our record to edit or save
DO CASE
  CASE lcAction = "Save"
    *** Save the data from the Request object
    loSC = CREATE("wwShowCursor")
    loSC.SaveRecord()
    pcMessage="Record Saved"
ENDCASE
   
Response.Write([<form action="wc.dll?wwDemo~EditRecord~&Custno=] + ALLTRIM(lcCustNo) + [&Action=Save" method="POST">] +CRLF)


Response.Write([<input type="submit" name="btnSubmit" value="Save"><p>])

*** Always display the data
loSC = CREATE("wwShowCursor")
loSC.cExtraTableTags = [style="font:normal normal 10pt Arial"]
loSC.EditRecord()

Response.Write( loSC.GetOutput() )

Response.Write([</form>] + CRLF) 

Response.HTMLFooter

RETURN

See also:

Class wwShowCursor


  Last Updated: 7/5/2003 | © West Wind Technologies, 2008