[PSS 2016] Help to avoid event redundancy

Post feature requests, product enhancement ideas, and other product-specific suggestions here. Do not post bug reports.
Forum rules
Do not post any licensing information in this forum.
This topic is 7 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Lembasts
Posts: 405
Last visit: Wed Mar 20, 2024 1:40 pm
Has voted: 1 time
Been upvoted: 1 time

[PSS 2016] Help to avoid event redundancy

Post by Lembasts »

Redundancy in coding is a criminal offence IMHO.
I have a central file called CommonFunctions.ps1 which include common functions I use within and between all my projects.
It would be great to be able to include events as well.
For example, I am using a suggestion from one of your blogs to have a central $control_Validated event for all controls.
It would be nice to not have to include this event code in all my psf files. i.e the drop down list I use to select the event function for each event would include events from within the psf AND events in a designated 'common' file.
Thanks
David
DevinL
Posts: 1098
Last visit: Tue Jun 06, 2017 9:15 am

Re: [PSS 2016] Help to avoid event redundancy

Post by DevinL »

While extremely useful and helpful, I can see this taking a bit of time to implement.

That being said, I've added this to the wish list and if anything comes of it I'll be sure to post it here.
DevinL
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: [PSS 2016] Help to avoid event redundancy

Post by Alexander Riedel »

Hmm, I would go with that the event handlers should ALWAYS be with the form and all other functions and handlers associated with the particular form.

But there is nothing that keeps you from calling the same validating function from the different event handlers.
That also makes it easier to add specialized validation before or after your stock validation is executed.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Lembasts
Posts: 405
Last visit: Wed Mar 20, 2024 1:40 pm
Has voted: 1 time
Been upvoted: 1 time

Re: [PSS 2016] Help to avoid event redundancy

Post by Lembasts »

Alexander Riedel wrote:Hmm, I would go with that the event handlers should ALWAYS be with the form and all other functions and handlers associated with the particular form.

But there is nothing that keeps you from calling the same validating function from the different event handlers.
That also makes it easier to add specialized validation before or after your stock validation is executed.
Yes I do call the same $control_Validated event from all the controls within the form.
Just that I have about 2 dozen forms and the same $control_Validated is coded in each of them.
Maybe populating $this is an issue?
This topic is 7 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked