trim leading and trailing spaces in cmsAdmin v 2.62

6 posts by 3 authors in: Forums > CMS Builder
Last Post: July 31, 2014   (RSS)

By kitsguru - July 29, 2014

BUG ALERT

In v2.62 the edtor does not trim the leading or trailing spaces before inserting into the database. I can't think of where this not appropriate and all leading and trailing spaces should be deleted.

If there is a use case to have leading or trailing spaces then an option to trim spaces defaulted ON would be good.

Jeff Shields

By kitsguru - July 29, 2014

I was referring to text fields and not wysiwyg. I don't need you to write a plug in as I can easily do that. Just hadn't noticed it before - usually because I don't do data entry often. I wouldn't necessarily make it an option but default behaviour makes sense to me but that's your call.

Bug or Feature? - I vote bug especially now that we have indexing and field type options.

Jeff Shields

By ross - July 31, 2014

Hi Jeff

Thanks for the feedback! I'll have a discussion with Dave about how we will proceed on this one.  Let us know if you find anything else for us to review :).

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By Dave - July 31, 2014

Hi Guys, 

It's definitely not a bug, in that we never intended whitespace to be stripped and that the database is accurately storing and retrieving what was entered in, so it's operating as designed.

The issue remains of if it's intuitive and what the user would expect to happen.  We've got people relying on the feature right now for sorting and padding.  So the problem we run in to is if we started stripping whitespace it would break functionality for those users and confuse other users who intended spaces (or other whitespace characters) to be saved.  We also need to consider is how many support queries adding or removing a feature will generate and the added complexity of adding more options to the settings.  

So I think a plugin is the best way to handle it right now, and we'll keep the idea open of an advanced plugin that has this and a lot of other forum enhancements and ideas.  That would allow advanced users to tweak the settings and still keep the UI simple for regular users.

Jeff, if you do write a plugin, could you post it on this thread?  Thanks!

Dave Edis - Senior Developer
interactivetools.com

By kitsguru - July 31, 2014 - edited: July 31, 2014

Point taken, here is a simple plugin for any who need it.

Plugin Name: Trim Whitespace
Description: trims leading and trailing whitespace on text fields using trim()
Author: Jeff Shields
Author URI: http://yaadev.com
Version: 1.01
Requires at least: 2.50

Jeff Shields
Attachments:

trimWhitespace.php 1K