Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

script to remove extra spaces ?

Featured Replies

Hi,

Is there a way to remove spaces from a field? I am using firstname and lastname fields in a url to pull up a search page, if they enter a space in the field by accident when they input their name, the url which is created from that is broken. I don't know much about scripts, but thought maybe it could be done.

http://www.url/xmas/FMPro?-db=card&-lay=data&-format=[FMP-field: format]&-error=search_error.htm&-op=eq&firstname=[FMP-field: firstname]&lastname=[FMP-field:lastname]&-Find

Thanks for the help.

Consider:

&-op===&firstname=[FMP-field: firstname]&-op===&lastname=[FMP-field:lastname]

You can use some Javascript to "condition" the values before the Form is submitted.

All the best.

Garry

The "[FMP-field: firstname and [FMP-field:lastname]"

should be ideally served already flittered to the web page e.g. with SUBSTITUE() function from calculated field.

I use this script for large text files that are dragged into a field. With these particular files the amount of spaces can be in the hundreds. the substitute looks for two spaces and replaces with one, pattern count also looks for 2 spaces and if none found exits loop, the trim function removes any beginning and ending spaces.

Set Field [ TxtBuffer, Trim(TxtBuffer) ]

Loop

Set Field [ TxtBuffer, Substitute(TxtBuffer, " ", " ") ]

Exit Loop If [ PatternCount(TxtBuffer, " ") = 0 ]

End Loop

Regard

Rod

I use this script for large text files that are dragged into a field. With these particular files the amount of spaces can be in the hundreds. the substitute looks for two spaces and replaces with one, pattern count also looks for 2 spaces and if none found exits loop, the trim function removes any beginning and ending spaces.

Set Field [ TxtBuffer, Trim(TxtBuffer) ]

Loop

Exit Loop If [ PatternCount(TxtBuffer, " ") = 0 ]

Set Field [ TxtBuffer, Substitute(TxtBuffer, " ", " ") ]

End Loop

Regard

Rod

  • Author

Thanks to all of you for the suggestions. I will work on it.

Script is OK if you want to have result stored and indexed. Otherwise just use calculation field.

Say that looks like a ScriptMaker Script, not a JavaScript. You must have written that for a site which has just one visitor.

If anyone around here is an expert on ScriptMaker on the web, it is ME.

Buddy, if that script is open to more than one user, you ain't tested your ScriptMaker script vigorously or effectively. You better get to work on that!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.