• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

Input Text Box Required

Hi

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
0
DavidAbbott
Asked:
DavidAbbott
  • 4
  • 3
  • 2
2 Solutions
 
CRAKCommented:
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:

@DialogBox(...);
Field <visible> := <visible>;
@If(
   <hidden> != "";
   @SetField("<visible>", <hidden> + @Char(10) + <visible>);
   @Success);
Field <hidden> := ""
0
 
DavidAbbottAuthor Commented:
Sorry, need it in script, forgot to mention that bit
0
 
madheeswarCommented:
dim ws as new notesuiworkspace
dim uidoc as notesuidocument
dim curdoc as notesdocument

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

tmpoldvalue=curdoc.fieldnametobeAppendedInFirst(0)

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

curdoc.fieldnametobeAppendedInFirst=ss.commonusername+" updated on "+Today+": "+tmpnewvalue(0)+" "+tmpoldvalue
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
CRAKCommented:
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
0
 
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
0
 
madheeswarCommented:
in the starting keep
dim ss as new notessession

Even CRak solution is also good.
0
 
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?
0
 
madheeswarCommented:
Please post a Question in Comunity Support with this link for Point split (50/50).
its free.

thanks
-maddy
0
 
DavidAbbottAuthor Commented:
OK done.

Thanks to you both
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now