Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


  

PreviousPrevious NextNext

RE: Dialogs, Buttons and 'OnUnload\QueryClose'
~Umberto Nongeroson 22.Aug.03 02:26 PM a Web browser
Applications Development 6.0.2 CF1 Windows 2000, Windows XP, Windows 98



Anthony -
Try using a temporary "display" document to perform your validation against instead. For example:
    sub main()
    on error goto errorHandler

    dim wrkspc as NotesUIWorkspace
    dim uiDoc as NotesUIDocument
    dim thisDoc as NotesDocument
    dim dispDoc as NotesDocument
    dim bShowDbox as Boolean
    dim bIsDocValid as Boolean
    dim sMsg as String
    dim vTmp as Variant
    dim reqFldsLst List as String

    set wrkspc = new NotesUIWorkspace
    set uiDoc = wrkspc.CurrentDocument
    set thisDoc = uiDoc.Document
    set dispDoc = new NotesDocument(thisDoc.ParentDatabase)

    reqFldsLst("Label for required field #1") = "RequiredFieldName_01"
    reqFldsLst("Label for required field #2") = "RequiredFieldName_02"
    reqFldsLst("Label for required field #3") = "RequiredFieldName_03"

    uiDoc.AutoReload = false

    call dispDoc.ReplaceItemValue("FieldToLoad", thisDoc.GetItemValue("FieldToLoad"))
    '// insert code to load the display document with any additional values you may need

    bShowDbox = true
    while bShowDbox
    if not(wrkspc.DialogBox("(SomeSubFormName)", true, true, false, true, false, false, "Dialog title . . .", dispDoc)) then
    Print "Action cancelled . . ."
    Goto subExit '//if user cancels the dialog, exit
    else
    sMsg$ = "Please provide a value for the following fields:" & Chr(13)
    bIsDocValid = true
    forall fld In reqFldsLst
    vTmp = dispDoc.GetItemValue(fld)
    if trim$(vTmp(0)) = "" then
    bIsDocValid = false
    sMsg$ = sMsg$ & listtag(fld) & Chr(13)
    end if
    end forall

    if bIsDocValid then
    bShowDbox = false
    else
    msgbox sMsg$, , "Required fields . . ."
    end if
    end if
    wend

    '// update the document with new values provided by user in the dialogbox
    forall fld In reqFldsLst
    call thisDoc.ReplaceItemValue(fld, dispDoc.GetItemValue(fld))
    end forall

    call uiDoc.Reload()

    subExit:
    if not(uiDoc is nothing) then
    uiDoc.AutoReload = true
    end if
    exit sub

    errorHandler:
    Msgbox "Error " & Err & ": " & Error$ & " encountered at line " & Erl & " of " & Getthreadinfo(1) & ".", ,_
    "Error encountered . . ."
    print "Error " & Err & ": " & Error$ & " encountered at line " & Erl & " of " & Getthreadinfo(1) & " . . ."
    resume subExit
    end sub

This allows you to perform the validation from within the calling procedure while giving the user as many chances as s/he wants to try to get it right.
dgg




Dialogs, Buttons and 'OnUnload\Quer... (~Juan Zekkroste... 22.Aug.03)
. . RE: Dialogs, Buttons and 'OnUnload\... (~Richard Nontoo... 22.Aug.03)
. . . . Re: Dialogs, Buttons and 'OnUnload\... (~Juan Zekkroste... 23.Aug.03)


Document Options






  Document options
Print this pagePrint this page

Search this forum

Forum views and search


  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Category
Platform
Release
Advanced search

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS