AnsweredAssumed Answered

Cleaning up pasted text into a field - TextFormatRemove

Question asked by dbreitbach213 on Oct 19, 2016
Latest reply on Oct 19, 2016 by dbreitbach213

In my Purchase Order system, I have users who copy and paste the item description they are purchasing from a web page.

All types of fonts and formats show up in the description field of each PO Lineitem.


I am trying to come up with a good way that will clean up the format of the text, but still allow them to do there own formatting when required (Bold, Underline, etc).


I setup a Boolean field in LineItem table I called DescFix.


Currently, I have a Script Trigger for when they exit the field as follows....

If (not LineItem::DescFix)

    Set Field (LineItem::Desc; TextFormatRemove (LineItem::Desc))

    Set Field (LineItem::DescFix; True)

Else If (IsEmpty (LineItem::Desc))  // Just in case they clear it and start over

  Set Field (LineItem::DescFix; False)

End If


Using this method, when they initially paste into the field and then exit the field, it will set the Text attributes to the default.

Then if they want to alter them (maybe Bold the first two words or whatever), they can do so.


My question: Is there a better way to accomplish this?