Issues with saving new records


Author
Message
Ben Kim
Ben Kim
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 99, Visits: 253
When designing a form, one of our requirements is to allow the end user to enter text such as "Police Uniform" for a description.  However if the user types "Police Uniform    " (spaces), we want to trim the field.  So I turn on Trim Right in the BO.  Now I cannot type a space after the letter "e" in police. 

So I was advised to change the BindingUpdateMode to "OnValidation".  Now when I add a new record, type in a description like above, the description is NOT saved and is blank in the database and is displayed as blank on the UI form!

What gives?

Ben

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The OnValidation DataSourceUpdateMode has issues... only certain actions within .NET cause the control to update.  If the description was the last field you entered, and you immediately click the save button after you enter the field, the validation will not fire.  Hence, we default the DataSourceUpdate mode to OnPropertyChanged.  Your best bet is probably to remove the auto-trim option from the field on the BO and trim the value within the CheckRulesOnCurrentRow event.

Me.fld_Description = Me.fld_Description.Trim()

Ben Kim
Ben Kim
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 99, Visits: 253
I appreciate the workaround - however we have thousands of string fields!  Is this issue going to be addressed any time soon?

Ben

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
There really isn't a whole lot we can do.  The problem you're running into is a .NET binding issue.  The .NET data binding does not always properly fire the OnValidation method, additionally, this is how the .NET data binding interacts with the control.  The problem that you're running into is a .NET issue.

We can add this to the "to-look-at" list, but I make no guarentees that this will change until a future release of .NET.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
What about adding a setting in the BO Mapper that would just add the code mentioned automagically?
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
In this example you would never be able to add a space.
Ben Kim
Ben Kim
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 99, Visits: 253
I think what Greg is saying, instead of doing the Trim'ing the way StrataFrame currently does it, why not add code to the .Designer file automatically that will .Trim each field correctly before saving the entry (Insert, Update) based on the Trim setting in the Business Object Mapper?

Ben

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Yep, that is what I'm saying. BigGrin



Why not just add an event handler automatically to handle the CheckRulesOnCurrentRow in the designer? The user could have another handler. They would just have to be clear that trimmed fields might or might not yet be trimmed.
Ben Kim
Ben Kim
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 99, Visits: 253
Trent,

You are correct.  I cannot type something like "Police Officer" because the BO keeps trimming the space much like setting it up via the Business Object Mapper.

So what do you suggest?  Here is what I want:

User types "Police Man    " (trailing spaces)

We automatically trim the field to "Police Man"

Ideas?

Ben

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
You're wanting an automated solution for something that will take some engineering.  This will have to be done at the BO level or require a change to the textbox control.  You can create your own textbox by inheriting the StrataFrame textbox.  In the Validating event you could manage this.  (I would recommend having a property to determine whether or not to do anything.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search