问题
I am new to Domino designer and lotus script,
I tried to access my text field by:
Sub Click(Source As Button)
Dim myText As String
myText = Inputbox("insert some text :","Testing Heading","Default value test",100,100)
Msgbox "you have entered : "+myText
[myfield].text = myText //error
End Sub
but it shows an error:
named product field does not exist
Googled for it but can't find the solution.
One more, searched for tutorials for creating forms,views,database in domino designer for beginners. But can't find one.
If possible please provide links to tutorial sites.
EDIT 1:
Sub Click(Source As Button)
Dim myText As String
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim enteredText As String
myText = Inputbox("insert some text :","Testing Heading","Default value",100,100)
Msgbox "you have entered : "+myText
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
doc.addrfield = myText
enteredText = doc.addrfield
Msgbox "Data entered in addrfield : "+ enteredText //error
End Sub
Error:
Object variable not set
EDIT 2:
@Knut
In Domino Designer, how database tables can be created ?
I mean something like create table <tablenam> (field1,feild2,..)
;
How can I access it. I refered this. This guy showed me how how to connect to database but did't show how to create DB table.
回答1:
You have to use the LotusScript Notes classes to
- get the current open UI document
- get the corresponding back-end document
- set the item (=field)
Your example would look like this then:
Sub Click(Source As Button)
Dim myText As String
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
myText = Inputbox("insert some text :","Testing Heading","Default value",100,100)
Msgbox "you have entered : "+myText
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
doc.myField = myText
End Sub
You could use doc.ReplaceItemValue instead. It gives you a bit more flexibility.
The Designer help file itself gives you an introduction to Notes development in chapter "Application Design".
来源:https://stackoverflow.com/questions/28050641/how-to-access-textfield-value-in-lotus-script-for-domino-designer