Jump to content

Remove spaces from data field


Danovh

Recommended Posts

You should be able to do this with an empty text rule. Just paste this code into the syntax section and rename the field to what you need it to be.

var myOldString = Field("Name");
var myNewString = myOldString.replace(/ /g, "");
return myNewString;

Using the global (g) after the search criteria / / lets you replace all of the spaces in the field.

Link to comment
Share on other sites

  • 8 months later...

Can someone give me the JavaScript to remove extra spaces from the end of a text field? I need to retain them between my company names but the end of the field has about 30 spaces I need to remove.

 

This code removes all of the spaces.

 

You should be able to do this with an empty text rule. Just paste this code into the syntax section and rename the field to what you need it to be.

var myOldString = Field("Name");
var myNewString = myOldString.replace(/ /g, "");
return myNewString;

Using the global (g) after the search criteria / / lets you replace all of the spaces in the field.

Link to comment
Share on other sites

  • 1 year later...
This worked great in Fusion Pro, but as soon as I pulished it in Marcom Central, the spaces appear. It is an open text field for my user, but no matter what they type, I want there to be no spaces. Is there something else I need to do to make sure it works in my e-store?
Link to comment
Share on other sites

This worked great in Fusion Pro, but as soon as I pulished it in Marcom Central, the spaces appear. It is an open text field for my user, but no matter what they type, I want there to be no spaces. Is there something else I need to do to make sure it works in my e-store?

Please post questions specific to MarcomCentral in the MarcomCentral forum

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...