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 Dave - July 29, 2014

Hi Jeff, 

I don't think we ever trimmed spaces?   And is it for text fields or wysiwyg fields?

In general we like to keep options and "non-obvious" behaviour to a minimum.  We could probably write you a plugin to strip leading/trailing whitespace on save though if you wanted that.  Let me know if you do and I'll whip it up for you.  I think it should just be a few lines of code and would provide an easy way to enable that functionality.

Dave Edis - Senior Developer
interactivetools.com

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 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