Danovh Posted August 21, 2009 Share Posted August 21, 2009 Is it possible to remove spaces from a data field? such as the space between fist name and last name. Link to comment Share on other sites More sharing options...
LesSjo Posted August 21, 2009 Share Posted August 21, 2009 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 More sharing options...
Danovh Posted August 21, 2009 Author Share Posted August 21, 2009 Thank you very much, that worked perfect. Link to comment Share on other sites More sharing options...
mcsdigital Posted May 13, 2010 Share Posted May 13, 2010 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 More sharing options...
esmith Posted May 13, 2010 Share Posted May 13, 2010 // The Trim() function removes leading and trailing spaces only return Trim(Field("Text")); Link to comment Share on other sites More sharing options...
mcsdigital Posted May 13, 2010 Share Posted May 13, 2010 Thank you. That's perfect. Link to comment Share on other sites More sharing options...
apalmer Posted May 20, 2011 Share Posted May 20, 2011 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 More sharing options...
Dan Korn Posted May 20, 2011 Share Posted May 20, 2011 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.