StrataFrame Forum

Preventing form from entering into edit mode

http://forum.strataframe.net/Topic436.aspx

By Scott - 1/17/2006

I have a form,  when the user clicks the edit button I want to be able to check to verify that this record can be edited,  not because of user security but if records exist in a secondary table I want to be able to prevent the user from modifying this record.

Any suggestions.

By StrataFrame Team - 1/17/2006

You can handle the CheckSecurity event. I know it's not security, but if we put another event there, it might be redundant...

Within the event, just check your secondary business object and if its Count = 0 then set e.Allowed = false;. It will then raise the SecurityDenied (allowing you to show an error message) event rather than editing the business object.
By Scott - 1/17/2006

That works great thanks Ben.
By Scott - 1/17/2006

For the CheckSecurity event to fire you need to pass true to the business objects edit (action) method, correct?  I am using the stand Stratframe maintenance form,  Is there a way to make the toolstip add the true parameter to all of its calls or do I have to write the code in the itemclicked method of the tools strip.
By Gary C Wynne - 1/18/2006

Hi Scott

>For the CheckSecurity event to fire you need to pass true to the business objects edit (action) method, correct? 

The CheckSecurity event should fire for you when the BO is Edited. You shouldn't have to do anything. If the BO you want to edit isn't the form's Primary Business Object, then you might want to look at the form's IncludeInFormEditType property; this allows the scope of the edit to be applied to the form's PrimaryBusinessObject (default), AllBusinessObjects or DeterminedByBusinessObject. On the BO, there is a property called IncludeInFormEdit that you would set true if you used DeterminedByBusinessObject on the form.

Using these flexible properties on the form and BOs, you should be able to configure which BOs you want to be affected by the Edit "state". FYI, this capability can be extended to "New", "Undo", "Navigated", "Save" and "Delete" states too!

Hope I am on the right lines here Smile

Best

-=Gary

By StrataFrame Team - 1/18/2006

Scott,



If you don't have the properties that Gary mentioned, you'll need the latest version Smile



The newest update provides the IncludeInFormType properties and the MaintenanceFormToolstrip methods always pass True, so that the CheckSecurity event is raised.
By Scott - 1/18/2006

Didn't know there was an update.  That did the trick.  Works great.
By StrataFrame Team - 1/18/2006

Smile glad you found it