Forum Discussion

KaranBhavsar's avatar
KaranBhavsar
Qrew Trainee
7 years ago

Add text to a text field without replacing the existing data and without the name - date stamping

How can I add text to a text field without replacing the existing data and without the name - date stamping ? (The data I want to add to text field is from Html page.)

9 Replies

  • ChrisChris's avatar
    ChrisChris
    Qrew Assistant Captain

    Do you want to import these changes or enter them one at a time using the form?

    If you want to import en masse such a change to a text field without overwriting what is currently there, you may need to use an intermediate formula text field, and, a new text field to import into.

    Can you provide your desired approach to making the edits to this text field?


  • Ok, so I have to use an intermediate Formula Text Field and write a formula to replace the text inside square brackets along with the brackets with a comma. How can I achieve that?
    • ChrisChris's avatar
      ChrisChris
      Qrew Assistant Captain

      Let's say you have a field into which you import the additional text. Let's call it for now, [Additional Text]. << this is to be a normal, multi-line text field.

      Let's create a formula text field, [Text field plus additional text]. << This is a 'formula text' field.

      Inside the code for the formula text field, [Text field plus additional text], you will say,

      [my current text field] & " any separator characters " & [Additional Text]


      [My current text field] is whatever your current text field is whose "content" is to be appended to within your formula text field.

      Your import spreadsheet would import only into [Additional Text]. Not any of the other two text fields.

      You would create or modify existing reports using the formula text field, [Text field plus additional text]. In other words, your reports will use [Text field plus additional text].

      Your current already in use text field would be for normal single record form input.

      Does this make sense?


    • KaranBhavsar's avatar
      KaranBhavsar
      Qrew Trainee
      In the image I shared; my multi-line text field (say [Data] ) already had data "John, Shawn, Josh". Then through the HTML page that I attached below, I add more data i.e. "6" and "9.2" to the same multi-line text field [Data] that gets added with date-name stamp. If I add more data i.e. "10"; it will get added to the same [Data] with date-time stamp and will look like this. 

      John, Shawn, Josh [NOV-01-17 karan-bhavsar] 6 [NOV-01-17 karan-bhavsar] 9.2 [NOV-01-17 karan-bhavsar] 10

      I want to replace the text inside square brackets along with the brackets with a comma so that I get this >> John, Shawn, Josh, 6, 9.2, 10

      How can I achieve this using formula text field.
      ")
    • ChrisChris's avatar
      ChrisChris
      Qrew Assistant Captain
      In the properties of the original text field, it looks like you have "Log edits to this field and show them on forms" checked. If you uncheck that property, you will not get the data in the square brackets.
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    I'd suggest making the 'additions' as child records.  You already have the html page set up to it'll be a breeze to make those as line items.

    "log edits" is really just a crutch for most cases and usually comes up against these types of limits often.
  • When you edit a record there is a hidden <input> on the form for every field which records the "old" value of the field. So for a field with fid=6 there is the visible <input> with id=_fid_6 and a hidden <input> with name=_fid_oval_6. So what you can do is modify the Save button click handler to first concatenate the value in hidden <input> with the value in the visible <input> and place this concatenated value into the visible <input> and then do the normal Save routine.

    Here  is the code to use with IOL that does the trick:

    var originalClickHandler = $("#saveButton").data("events").click[0].handler;
    $("#saveButton").unbind("click");
    $("#saveButton").on("click", function() {
      $("#_fid_6").val($("[name=_fid_oval_6]").val() + ", " + $("#_fid_6").val());
      originalClickHandler();
    });
    There is no need to use formulas or a child table. The behavior you want should be implemented directly on the form when the keystrokes are entered and the form is Saved.