|
|
|
BlueCielo Meridian Enterprise 2012 Developer's Guide | BlueCielo ECM Solutions |
Returns a Boolean value indicating whether or not data on the page can be saved.
CanApply is called for each page when changes need to be saved. Only when all pages return True will the ApplyChanges method be called. If any page returns False, the pages will remain in edit mode for the user to correct the problem. This code should never be removed.
Following is the default extension of this method in the form templates:
Private Property Get IAMExtensionPage_CanApply() As Boolean
On Error GoTo Error_handler
Dim bDataValid As Boolean
' Todo
' Add your code here
bDataValid = True
Me.ValidateControls
If Not m_Designer Is Nothing Then
' Set the edit mode of the datasource
IAMExtensionPage_CanApply = m_Designer.CanApply(Me) And bDataValid
End If
Exit Sub
Error_handler:
MsgBox caption & " CanApply: " & Err.Description
End Property
You can add extra code to check if the data entered by the user is valid, as in the following example.
Private Property Get IAMExtensionPage_CanApply() As Boolean
On Error GoTo Error_handler
Dim bDataValid As Boolean
' Check the information entered by the user
If txtProjectName.Text = "" Then
bDataValid = False
' Explain why the input is invalid
MsgBox "You must enter a project name!"
' Make sure this page (with the invalid input) is visible
SwitchToPage m_Designer, Me.caption
' Set focus to the field that needs to be corrected
txtDrawingNumber.SetFocus
Else
bDataValid = True
End If
Me.ValidateControls
If (Not m_Designer Is Nothing) Then
IAMExtensionPage_CanApply = m_Designer.CanApply(Me) And bDataValid
End If
Exit Sub
Error_handler:
MsgBox caption & " CanApply: " & Err.Description
End Property
' See Name property to define the name of your page
Public Sub SwitchToPage(UIExt As IAMUIExtensionDesigner, Name As String)
Dim pf As IAMPagesFrame
Set pf = UIExt.GetHostService(SERVICE_PAGESFRAME)
If Not pf Is Nothing Then
pf.CurrentPage = Name
End If
End Sub
Related information
PageHandlesErrors property
Copyright © 2000-2012 BlueCielo ECM Solutions |