Soru Add Initials to start of Text in Text Box

  • 08 Mayıs 2012 Salı 17:51
     
     

    We have a infopath form that has a multiline text box for comments. Right now, every time someone adds a comment we have to trust them to put their initials and date before the comment and start each comment on a new line ie:

    [04/17] AB: This is my comment.

    [04/18] BC: Well this is my comment to your comment.

    But some users are forgetting to put their initials and so someone has to track down who made the comment. I would like to use code or rules to automatically add at least their first name or something in front of the comment so that the user doesn't have to do it themselves.

    I could use a web service to get their first name and functions to get the date but I don't exactly know how I would append that stuff to their line of comment.

Tüm Yanıtlar

  • 08 Mayıs 2012 Salı 18:01
     
     
    You could modify the multiline text box column and change "Append Changes to Existing Text" to Yes.  All comments will be timestamped along with the user's name as the comments are saved in the list/library.
  • 08 Mayıs 2012 Salı 18:50
     
     
    I don't need to see the comments in the library - I just need them on the form. We don't even have that column exposed in the library. It is purely for the form.
  • 10 Mayıs 2012 Perşembe 02:35
    Moderatör
     
     

    Hi ,

    I understand that you want to add time and username automatically when a user opens the form .You can refer to the steps below:

    Create a new notepad file and type in these codes .Save the txt file  as an XML file :

            <?xml version="1.0" encoding="UTF-8"?>
           <characters
           cr="&#xD;"
          lf="&#xA;"
           crlf="&#xD;&#xA;"
         />

    1. Open the form in InfoPath Designer .Add a data connection to retrieve file from the  XML file created in step1 .
    2. Click the Data tab and click Form load button to add aform load rule .
    3. Choose 'Set a field's value as the action ' .Set the multiple line of text field (let call it field1 here )to the value of   

    'concat(field1,@crlf,today(),Display Name,':',@crlf)'

    You need to choose insert field to insert the @crlf field .Display Name is get from the web service where you get the user first name .

    For more information ,please refer to this site:

    Inserting line breaks into text using Rules:http://blogs.msdn.com/b/infopath/archive/2005/03/04/385577.aspx

    Thanks


    Entan Ming

    TechNet Community Support

  • 10 Mayıs 2012 Perşembe 15:44
     
     
    I don't want it to happen as soon as somebody opens the form, I want it to happen when they place the cursor in the multi-line text box