Input Text Box Required


I am after some code which would allow a button on a form to bring up a dialog box, which in turn would allow text to be input, when this box is closed the text would then appear in a field on the form, this text would be appended to any other text that mihgt have already been typed into the box at an earlier date.

The text should be placed at the top of the other text in the field and it must have a date and user text stamp in the same field before the typed text.

Any help
Who is Participating?
CRAKConnect With a Mentor Commented:
Easiest I think (depending on what you already have) is to make the dialogbox update a hidden, editable field.

After opening the dialogbox you could transfer that hidden field's value to the visible one and empty the hidden one again.

Something like:

Field <visible> := <visible>;
   <hidden> != "";
   @SetField("<visible>", <hidden> + @Char(10) + <visible>);
Field <hidden> := ""
DavidAbbottAuthor Commented:
Sorry, need it in script, forgot to mention that bit
madheeswarConnect With a Mentor Commented:
dim ws as new notesuiworkspace
dim uidoc as notesuidocument
dim curdoc as notesdocument

set uidoc=ws.currentdocument
set curdoc=uidoc.document


tmpnewvalue=Inputbox("What is the new value?")

curdoc.fieldnametobeAppendedInFirst=ss.commonusername+" updated on "+Today+": "+tmpnewvalue(0)+" "+tmpoldvalue
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I created a small setup:
-A dialogform "myDialog", containing a field "myNewValue" (ed, txt) in a layout-region.
-A form (name not important) containing a hidden, editable text field "myFld", a visible computed for display text field "myFldDsp" (formula: myFld) and a button "Add to field", containing following script:

Sub Click(Source As Button)
      Dim Session As New NotesSession
      Dim Db As NotesDatabase
      Dim Doc As NotesDocument
      Dim Ws As New NotesUIWorkspace
      Dim UIDoc As NotesUIDocument
      Dim oldTxt As String
      Dim newTxt As String
      Dim flgDlg As Integer
      Set Db = Session.CurrentDatabase
      Set Doc = Db.CreateDocument
      flgDlg = Ws.DialogBox("myDialog", True, True, False, False, False, False, "Enter your new value", Doc)
      If flgDlg Then
            Set UIDoc = Ws.CurrentDocument
            oldTxt = UIDoc.FieldGetText("myFld")
            newTxt = Doc.myNewValue(0)
            Call UIDoc.FieldSetText("myFld", newTxt & Chr$(10) & oldTxt)
            Call UIDoc.Refresh
      End If
End Sub
DavidAbbottAuthor Commented:
OK, thanks so far madheeswar's works except for the ss.commonusername buggs out, all the rest works, am looking at Craz now.

thanks so far
in the starting keep
dim ss as new notessession

Even CRak solution is also good.
DavidAbbottAuthor Commented:
madheeswar, both of you were very helpful, i tried to split points but the system gave them all to Crak, can we ammend at 50/50?

If not can i can give you points anyway?
Please post a Question in Comunity Support with this link for Point split (50/50).
its free.

DavidAbbottAuthor Commented:
OK done.

Thanks to you both
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.