StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Textbox - strange behaviour with BO left and...Expand / Collapse
Author
Message
Posted 07/13/2008 11:24:24 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 11/19/2008 9:55:09 AM
Posts: 170, Visits: 410
Hi,

I have set all my string fields to have left and right trim in the business object mapper. I have just noticed that if you try and enter a value such as "24 My Address" into a text box, the cursor jumps to the start each time a space is entered - it is impossible to enter a space.

Ideally, I am only trying to remove leading and trailing spaces rather than all spaces from the entire string.

Have I missed something?

Thanks in advance,

Aaron

Post #17826
Posted 07/13/2008 7:55:27 PM
Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 8:48:41 PM
Posts: 714, Visits: 3,004
Ideally, I am only trying to remove leading and trailing spaces rather than all spaces from the entire string.

Have I missed something?

Hi Aaron,

I believe that if you are using a varchar field type, the spaces will be trimmed when saved to the database.

 
Post #17828
Posted 07/14/2008 3:38:07 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 11/19/2008 9:55:09 AM
Posts: 170, Visits: 410
I believe that if you are using a varchar field type, the spaces will be trimmed when saved to the database.

Hi Edhy,

I am using varchars and the textbox control simply stops spaces from being entered - it happens as soon as the space key is pressed (long before the database save). If I set the trim operation to left only, the control allows spaces but when set to left and right no spaces can be entered.

I am hoping the left and right trim operation can be done either during the save or when the control loses focus.

Aaron

Post #17829
Posted 07/14/2008 8:05:07 AM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 10/12/2008 10:41:53 AM
Posts: 69, Visits: 1,282
Hello Aron,

I am hoping the left and right trim operation can be done either during the save or when the control loses focus.

I would try the BeforeSave-Event of the BO. Something like: 'this.myBO.toTrimField.Trim();'

But I think Edhy is right, I never had the need to trim anything with varchar-Fields.

HTH, Ralph

Post #17830
Posted 07/14/2008 10:07:43 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/02/2008 4:42:46 PM
Posts: 2,686, Visits: 1,890
The VarChar will prevent this from needin the Trim, but you can just put "Text" without the quotes in the BindingFormat property of the textbox while using the Trim() options and it will prevent the "weirdness."


www.bungie.net
Post #17833
Posted 07/14/2008 1:14:39 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 11/19/2008 9:55:09 AM
Posts: 170, Visits: 410
Hi Guys,

Thanks for the responses.

The problem I have is not what is written back to the database but more to do with what is returned by a BO field when it is accessed. For example, if you read a value from a BO field that is 20 characters long, then you will see different results depending on the trim settings:-

BO trim is set to left only, myBO.Name returns              "Aaron Young         "

BO trim is set to both left and right, myBO.Name returns "Aaron Young"

Obviously, I can use the trim command on any BO field reference but I want to be lazy and this seems like too much effort when the only problem is the textbox accepting spaces

I have a sub-classed Infragistics textbox control that removes leading and trailing spaces when the control leaves focus/editing mode. I had assumed the SF text control would do the same rather than put a block on all spaces when editing.

I dont want to appear fussy about this but left trim and right trim should allow spaces in the middle of your string. In the above example it would have been impossible to enter "Aaron Young" with left and right trim enabled. As I say I dont want to appear fussy about this but it would be a help if the control would allow spaces

Regards,

Aaron

Post #17834
Posted 07/15/2008 10:40:43 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
I have a sub-classed Infragistics textbox control that removes leading and trailing spaces when the control leaves focus/editing mode. I had assumed the SF text control would do the same rather than put a block on all spaces when editing.

Actually an SF textbox will allow you to have spaces in the middle if you set the BindingFormat to "Text" on the textbox itself.  By default this is not set, but if you set this value to that property (which is empty by default) it should work as you are expecting.

Post #17856
Posted 07/16/2008 12:55:44 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 11/19/2008 9:55:09 AM
Posts: 170, Visits: 410
That is good to know. I will subclass it and go back to my lazy way of working
Post #17883
Posted 07/17/2008 8:47:11 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
Cool
Post #17900
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase,