Required Fields Problem


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I've set some required fields on my BO. When I go to test it, I don't get any broken rule messages. It prompts me to save the bo. Here's what happens:



1. I click new

2. I click save (no data entered...should be some broken rules as many required fields aren't specified)

3. I get prompted to Save changes, no broken rules



In the BO, all I've done is setup my required fields. Is there something else I need to do to get these fields validated (or could I have turned something off)?
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Did the required fields get serialized (saved) to the source file?  There is really not much here.  If the RequiredFields collection has anything in it, they are checked within the BO when the save occurs.  If you put a debug in the CheckRulesOnCurrentRow does the RequiredFields collection have a count of zero?
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Did the required fields get serialized (saved) to the source file?


yes.



If you put a debug in the CheckRulesOnCurrentRow does the RequiredFields collection have a count of zero?


Yes. There are three required fields in that collection.



The save is getting called by directly calling the Save method on the BO. I tried calling the CheckRulesOnRow() method, but same behavior (just checked the rules twice). Are the required fields checked before or after the CheckRulesOnRow event is raised? Anything I might be doing wrong?



Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Correction...

If you put a debug in the CheckRulesOnCurrentRow does the RequiredFields collection have a count of zero?


No. There are three required fields in that collection (the same number I checked as being required)

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
What is the return value of the Save() method when you call it on the BO?  Is it AbortedWithBrokenRules?
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Actually, what happens is that I get prompted to save changes. If I say yes, then I again get prompted to save changes. This goes on until I select no (don't save changes). The return is then Success {0}.



So, I'm probably not doing this correctly. What else do I need to do when manually calling Save() on a BO?
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
So, when you call Save() on the BO, you get the message asking you if you want to save changes?  That's odd... that message should only be showing when you try to close the form.  If you put a handler on the BO's AfterSave event, is it ever reached?  And there's also a BusinessRulesChecked event on the BO that will be raised after the business rules have completed checking.  You can check the count of the BrokenRules collection within that event to see if it added any broken rules from the required fields.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
So, when you call Save() on the BO, you get the message asking you if you want to save changes?


Yes.



That's odd...


Crazy



If you put a handler on the BO's AfterSave event, is it ever reached?


Yes. After I click no to saving the changes.



And there's also a BusinessRulesChecked event on the BO that will be raised after the business rules have completed checking. You can check the count of the BrokenRules collection within that event to see if it added any broken rules from the required fields.


No broken rules. I also only get to this event after clicking on No to not save changes.
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
When you put a break point in the BusinessRules checked, can you copy the stack trace and post it here.  You can post the whole thing by either copying the value of System.Environment.StackTrace or opening the Stack Trace debugging window and right-clicking it to Select All and then right-clicking it to Copy.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Here is the stack trace:



   RamsBase.dll!FOXSystems.RAMS.Base.Navigation.ListBONavBase._dataBO_BusinessRulesChecked(MicroFour.StrataFrame.Business.BusinessRulesCheckedEventArgs e = {MicroFour.StrataFrame.Business.BusinessRulesCheckedEventArgs}) Line 584 + 0x5 bytes   Basic

   MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.raise_BusinessRulesChecked(MicroFour.StrataFrame.Business.BusinessRulesCheckedEventArgs e = {MicroFour.StrataFrame.Business.BusinessRulesCheckedEventArgs}) + 0x8f bytes

   MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.OnBusinessRulesChecked(MicroFour.StrataFrame.Business.BusinessRulesCheckedEventArgs e = {MicroFour.StrataFrame.Business.BusinessRulesCheckedEventArgs}) + 0x20 bytes

   MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.ShowBrokenRules(bool RaiseCheckedEvent = true) + 0x366 bytes

   MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.CheckRules(bool RaiseCheckedEvent = true) + 0x2a0 bytes

   MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.Save(bool Transactional = false, string TransactionKey = "") + 0xed bytes

   MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.Save() + 0x2a bytes

   RamsBase.dll!FOXSystems.RAMS.Base.Navigation.ListviewBONavManagerByToolStrip._saveControl_Click(Object sender = {System.Windows.Forms.ToolStripButton}, System.EventArgs e = {System.EventArgs}) Line 312 + 0x17 bytes   Basic

   System.Windows.Forms.dll!System.Windows.Forms.ToolStripItem.RaiseEvent(object key, System.EventArgs e) + 0x41 bytes

   System.Windows.Forms.dll!System.Windows.Forms.ToolStripButton.OnClick(System.EventArgs e) + 0x3e bytes

   System.Windows.Forms.dll!System.Windows.Forms.ToolStripItem.HandleClick(System.EventArgs e) + 0xc7 bytes

   System.Windows.Forms.dll!System.Windows.Forms.ToolStripItem.HandleMouseUp(System.Windows.Forms.MouseEventArgs e = {X = 21 Y = 19 Button = Left}) + 0x220 bytes

   System.Windows.Forms.dll!System.Windows.Forms.ToolStripItem.FireEventInteractive(System.EventArgs e, System.Windows.Forms.ToolStripItemEventType met) + 0x87 bytes

   System.Windows.Forms.dll!System.Windows.Forms.ToolStripItem.FireEvent(System.EventArgs e, System.Windows.Forms.ToolStripItemEventType met) + 0x122 bytes

   System.Windows.Forms.dll!System.Windows.Forms.ToolStrip.OnMouseUp(System.Windows.Forms.MouseEventArgs mea) + 0xc7 bytes

   System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) + 0xf2 bytes

   System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x56f bytes

   System.Windows.Forms.dll!System.Windows.Forms.ScrollableControl.WndProc(ref System.Windows.Forms.Message m) + 0x45 bytes

   System.Windows.Forms.dll!System.Windows.Forms.ToolStrip.WndProc(ref System.Windows.Forms.Message m = {msg=0x202 (WM_LBUTTONUP) hwnd=0x1130e wparam=0x0 lparam=0x14007b result=0x0}) + 0x71 bytes

   System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativewindow.OnMessage(ref System.Windows.Forms.Message m) + 0xd bytes

   System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativewindow.WndProc(ref System.Windows.Forms.Message m) + 0xd6 bytes

   System.Windows.Forms.dll!System.Windows.Forms.Nativewindow.Callback(System.IntPtr hWnd, int msg = 514, System.IntPtr wparam, System.IntPtr lparam) + 0x75 bytes

   [Native to Managed Transition]

   user32.dll!7e418734()

   [Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]

   user32.dll!7e418816()

   user32.dll!7e4189cd()

   user32.dll!7e418a10()

   [Managed to Native Transition]

   System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(int dwComponentID, int reason = -1, int pvLoopData = 0) + 0x2ea bytes

   System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x17d bytes

   System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x53 bytes

   System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm) + 0x2e bytes

   MicroFour StrataFrame UI.dll!MicroFour.StrataFrame.Application.StrataFrameApplication.RunApplication() + 0x379 bytes

   RAMS.NET.exe!FOXSystems.RAMS.AppMain.Main() Line 28 + 0x6 bytes   Basic

   ntdll.dll!7c926abe()

   ntdll.dll!7c9268ad()

   ntdll.dll!7c91056d()

   kernel32.dll!7c80a027()

   ntdll.dll!7c91056d()

   ntdll.dll!7c926abe()

   ntdll.dll!7c9268ad()

   ntdll.dll!7c91056d()

   ntdll.dll!7c919bd3()

   ntdll.dll!7c910895()

   ntdll.dll!7c919a9c()

   ntdll.dll!7c919b3f()

   ntdll.dll!7c919aeb()

   ntdll.dll!7c919aeb()

   ntdll.dll!7c919ba0()

   kernel32.dll!7c80adde()

   kernel32.dll!7c80adf0()

   ntdll.dll!7c9106eb()

   ntdll.dll!7c9106eb()

   mscoree.dll!79004044()

   kernel32.dll!7c816fd7()

   ntdll.dll!7c9106eb()





The only code in the _dataBO_BusinessRulesChecked method is a "Stop" statement to get the stack trace.
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