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

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • In Progress
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.)
Photo of Karan Bhavsar

Karan Bhavsar

  • 178 Points 100 badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of Chris

Chris, Champion

  • 4,390 Points 4k badge 2x thumb

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?

Photo of Karan Bhavsar

Karan Bhavsar

  • 178 Points 100 badge 2x thumb

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?
Photo of Chris

Chris, Champion

  • 4,390 Points 4k badge 2x thumb

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?


(Edited)
Photo of Karan Bhavsar

Karan Bhavsar

  • 178 Points 100 badge 2x thumb
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.
")
Photo of Chris

Chris, Champion

  • 4,390 Points 4k badge 2x thumb
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.
Photo of Karan Bhavsar

Karan Bhavsar

  • 178 Points 100 badge 2x thumb
I am using Log edits so that when I click on Add button on HTML page, it appends the data to the data already present in the text field and not replace the existing data. 
Photo of Chris

Chris, Champion

  • 4,390 Points 4k badge 2x thumb
Okay, I thought you were taking a different direction, but it sounds like you want to keep log edits. I'm uncertain at this point what you wish to accomplish.
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb
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.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,512 Points 20k badge 2x thumb
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.
(Edited)