Search

Everything stated on this site is, of course, MY opinion / statement / thought, unless specifically stated otherwise. You knew that.

Blog Index
The journal that this archive was targeting has been deleted. Please update your configuration.
Navigation
« April Fool's - a day later | Main | Laptop warranty »
Tuesday
Apr012003

Quick LS to trim all text fields

Years ago I would use translation formulas on fields to keep the extra white space trimmed. Realizing that this was quite a performance hit on all but the most trivial forms, I began using exiting events. For some ridiculous reason, it didn't hit me until now to just plop a few lines in the QuerySave event to keep all fields trimmed up:

' Eliminate any extra white space in the fields
Forall itm In doc.Items
If itm.Type = 1280 Then
' Text field
Call doc.ReplaceItemValue( itm.Name, Trim$(itm.Text) )
End If
End Forall

The one caveat (so far :-) is to add a line or two to exclude any checkbox fields from that code. The trim seems to wipe out the contents of checkbox fields. Need to do more testing on that one, but it's quick enough to just add a list of checkbox fields (and maybe radio button, etc?) and have a glance at the list before doing the trim.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.