Y
Yarotskaya
Помогите написать на LotusScript проверку заполнения обязательных полей на форме с выводом сообщения и передачей фокуса ввода на незаполненное или неправильно заполненное поле.
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim doc As NotesDocument
Dim fields List As String
fields("SearchFieldType")="Тип поля"
fields("SearchField")="Наименование поля"
fields("SearchField_kaz")="Наименование поля (каз.)"
fields("SearchFieldName")="Имя поля в Lotus"
Set doc=source.Document
Forall f In fields
If doc.GetItemValue(Listtag(f))(0)="" Then
Msgbox "Не заполнено поле "+f
Continue=False
source.GotoField(Listtag(f))
Exit Sub
End If
End Forall
End Sub
dim reqFields List as String
reqFields("Поле1") = "Field1"
reqFields("Поле2") = "Field2"
Function HasRequired(doc As NotesDocument, fields As Variant) As Boolean
Dim Item As Variant
Dim Msg As String
HasRequired = False
Forall fieldName In fields
Set Item = doc.GetFirstItem(fieldName)
If Item Is Nothing Then
Msg = Msg + "- " + Listtag (fieldName) + Chr$(13)
ElseIf Item.Text = "" Then
Msg = Msg + "- " + Listtag (fieldName) + Chr$(13)
End If
End Forall
If Msg <> "" Then
Msg = "Не заполнены обязательные поля:" + Chr$(13) + Msg
MsgBox Msg
HasRequired = True
End If
End Function
Так, учимся читать справку!начальство хочет видеть эту проверку на скрипте!
Function CheckReqFields(Doc As NotesDocument, Flds List As String, ShowMsg As Boolean) As Boolean
On Error Goto Errh
CheckReqFields = False
If Doc Is Nothing Then Exit Function
Dim FldName As String
Forall x In Flds
FldName = Listtag(x)
If Trim$(FldName) <> "" Then
If Trim$(Implode(Doc.GetItemValue(FldName), "")) = "" Then
If ShowMsg Then Messagebox {Field "} + x + {" is required!}, 0 + 64, "Attention!"
Exit Function
End If
End If
End Forall
CheckReqFields = True
Exit Function
Errh:
Call ErrHandler
Exit Function
End Function
Взломай свой первый сервер и прокачай скилл — Начни игру на HackerLab