• Changed message box to Prompt box

    By David C Slatter 2 decades ago

    Hello Julian:



    I have added an option to display a Prompt Box instead of a message box.

    This would allow the user to pick the error line to correct and it will take them to the proper field.

    Let me know what you think?

    I add the following to the ValidateOrderForm1 :


    If (validator.Validate() &gt; 0) Then<br/>
        Print validator.GetErrorDetail<br/>
        '** Current<br/>
        Messagebox validator.GetMessage <br/>
    


        '** Add by David Slatter 01/07/2008 <br/>
        Call validator.DisplayPicklist( ) <br/>
        '** end of add<br/>
    


        ValidateOrderForm1 = False<br/>
    Else<br/>
        ValidateOrderForm1 = True<br/>
    End If<br/>
    







    And add the two functions to the Class DocumentValidator:

    '/**<br/>
    ' * Given the message it will return the index of the message<br/>
    ' *  Add by David C Slatter   1/07/2008<br/>
    ' */    <br/>
    Public Function GetBadFieldIndex( MessageToFind As String) As Integer<br/>
        GetBadFieldIndex = Arraygetindex ( Fulltrim( Split( message,sepChar )), MessageToFind )<br/>
    End Function    <br/>
    


    '/**<br/>
    ' * The will display a prompt box of the bad fields messages and allow user to pick a line. <br/>
    ' *  Will go to the correct ui field<br/>
    ' * Will return a true if the Prompt box is displayed.  <br/>
    '*  If no NotesUIWorkspace returns false.<br/>
    ' *  Add by David C Slatter   1/07/2008<br/>
    ' */    <br/>
    Public Function DisplayPicklist( ) As Boolean<br/>
        Dim FixThisField As String<br/>
        Dim index As Integer<br/>
        Dim ws As Variant<br/>
        Set ws = New NotesUIWorkspace<br/>
        If Not ( ws Is Nothing ) Then<br/>
            FixThisField= ws.Prompt( 4, &quot;Missing Data&quot;, &quot;The following fields are required. Please completed them before Saving.&quot;, &quot;&quot;, Fulltrim( Split( message,sepChar )) )<br/>
            If FixThisField &lt;&gt; &quot;&quot; Then<br/>
                index = Me.GetBadFieldIndex( FixThisField )<br/>
                doc.GotoField(Me.GetBadFieldNames()( index))<br/>
            End If<br/>
            DisplayPicklist = True<br/>
        Else<br/>
            DisplayPicklist = False<br/>
        End If<br/>
    End Function