Jump to content

How to "Kill" server events in web mode


estrify

Recommended Posts

Hi,

Is there a way to "eliminate" all server events thrown after one of them in web mode, to achieve something like VCL mode events sequence?.

 

For example, in web mode, this is sample enter-exit server event sequence with two UniEdits:

1 UniEdit1Enter

2 UniEdit1Exit (this event server sets the focus on UniEdit1 again, but this effect is not shown until event 5)

3 UniEdit2Enter

4 UniEdit2Exit

5 UniEdit1Enter (caused by event 2)

On server event 2, a server validation is done and a SetFocus is executed, so events 3 and 4 must be ignored. How we can achieve this?

 

In VCL mode, the sequence of events is exactly what we need:

1 UniEdit1Enter

2 UniEdit1Exit

3 UniEdit1Enter

 

Thanks in advance,

Link to comment
Share on other sites

Hi,

Is there a way to "eliminate" all server events thrown after one of them in web mode, to achieve something like VCL mode events sequence?.

 

For example, in web mode, this is sample enter-exit server event sequence with two UniEdits:

1 UniEdit1Enter

2 UniEdit1Exit (this event server sets the focus on UniEdit1 again, but this effect is not shown until event 5)

3 UniEdit2Enter

4 UniEdit2Exit

5 UniEdit1Enter (caused by event 2)

On server event 2, a server validation is done and a SetFocus is executed, so events 3 and 4 must be ignored. How we can achieve this?

 

In VCL mode, the sequence of events is exactly what we need:

1 UniEdit1Enter

2 UniEdit1Exit

3 UniEdit1Enter

 

Thanks in advance,

 

Hi,

 

Your question is same of the post http://forums.unigui.com/index.php?/topic/2021-problem-with-events-in-sequence/

See the considerations by farshad and me..

 

In the validation, using showmessage() will to kill upcoming server events.

 

Regards,

 

Cristiano

Link to comment
Share on other sites

Hi,

 

I try the ShowMessage solution. I'm afraid it doesn't work. With ShowMessage: now have two extra server events, the event sequence is

 

1 UniEdit1Enter

2 UniEdit1Exit (this event server now executes a ShowMessage and sets the focus on UniEdit1 again, but this effect is not shown until event 5)

3 UniEdit2Enter

4 UniEdit2Exit

5 UniEdit1Enter (caused by event 2. Here, the ShowMessage displays the message)

6 UniEdit1Exit (caused after closing the ShowMessage)

7 UniEdit1Enter

 

¿Any idea?...

 

¿It's possible to implement something simple like the following in the base class of UniGUI controls?:

 

Each form should have an actual focused property and a flag:

* if the flag is OFF, actual focused property changes with each control focus change, otherwise it remains unchanged

* if the flag is ON, only server events related with the active focused control should be processed if those events are ENTER, EXIT, KEYBOARD or MOUSE events (¿other events for other controls could be processed, like CHANGE events?)

* if the flag is ON, it must be turned off automatically, if we are focusing in the actual focused control.

 

This should work for both web and VCL modes. This way, the original sequence will work as following (if no control fires the flag, everything will work as it is doing now, so no one has to change his code):

 

1 UniEdit1Enter (the flag is OFF, so base control sets the active focused property of the form to UniEdit1)

2 UniEdit1Exit (programmer sets manually the flag ON so the actual focused property from now on could not change)

3 UniEdit2Enter (the flag is ON and UniEdit2 is not the focused control. It is a KEYBOARD, MOUSE, ENTER or EXIT event, so this event will be ignored)

4 UniEdit2Exit (the same as prior)

5 UniEdit1Enter (the flag is ON and actual focused control is the one, so base class resets the flag)

 

In this manner, in web mode the effective events are only 1, 2 and 5, similar to the 3 events sequence of VCL mode.

 

This way, it is semi-transparent, so the programmer only has to set ON the flag in EXIT events only if needed, since its reset is automatic, regardless if he is programming in web or VCL mode.

 

¿It's possible to include this logic?

 

Thank you in advance.

Link to comment
Share on other sites

  • Administrators

There is no way to stop an event after it is generated. The only way is to avoid it from being generated in client side. For Enter/Exit events I'm not sure if they can be avoided.

 

Actually, you shouldn't rely on such particular details when developing a web app. What do you want to achieve by disabling events?

Link to comment
Share on other sites

There is no way to stop an event after it is generated. The only way is to avoid it from being generated in client side. For Enter/Exit events I'm not sure if they can be avoided.

 

Actually, you shouldn't rely on such particular details when developing a web app. What do you want to achieve by disabling events?

 

My suggestion in the last post only seeks to match as possible the sequence of events in vcl and web modes (with vcl mode, there is no problem), knowing that the latter has its latency issues, and only in those cases you need it. Note that what I propose does not require you to avoid the generation of events, only prevents some to execute it's user's association on server side whenever you turn on a flag.

 

Some edits only have their validations when exit them (not on change event because they may have values that have to be revised: the value displayed was correct time ago, but not now), and they are as important fields so you should not exit them without introducing one correct value, so it refocus itself again.

 

If you are editing one of these critical edits and click on another normal field, there is no problem because the latter will not validate on a onexit event. But if you click in another critical field that has its server validation on the onexit event, you will have a beatiful loop, but only in web mode.

Link to comment
Share on other sites

My suggestion in the last post only seeks to match as possible the sequence of events in vcl and web modes (with vcl mode, there is no problem), knowing that the latter has its latency issues, and only in those cases you need it. Note that what I propose does not require you to avoid the generation of events, only prevents some to execute it's user's association on server side whenever you turn on a flag.

 

Some edits only have their validations when exit them (not on change event because they may have values that have to be revised: the value displayed was correct time ago, but not now), and they are as important fields so you should not exit them without introducing one correct value, so it refocus itself again.

 

If you are editing one of these critical edits and click on another normal field, there is no problem because the latter will not validate on a onexit event. But if you click in another critical field that has its server validation on the onexit event, you will have a beatiful loop, but only in web mode.

 

Yes estrify, i understand your concern.. and this indeed may occur.. as in my case i have not had this situation in two fields with validations in sequence, this did not happen to me..

 

In your case, what types of validations you need to do the outputs of UniEdits?

Link to comment
Share on other sites

May be the situation is not usual, but it is simply what you have to do if you must ensure that you can't leave an edit to go to another one unless its value is correct (if you have only one in a form, it's Ok, but if you have two, you could have the infinite loop because server events are launched and quoued before you could complete the validation, because of a simple line delay).

 

Please, don't worry. As I find this framework great and the activity of this forum really fantastic, I thought I could find easily a solution for this issue. Hence, since this problem is not usual at all, it seems to be two solutions:

 

1. Create two different forms, one for each edit that has onexit validation. Unacceptable in this case.

2. Implement an inherited form (to contain the property and the flag) and for each control that has validations onexit, write the same code to detect if the event must be ignored, looking forward to the possibility of extending UniGUI components coming soon, to avoid repeating so much code (Intraweb framework suffers exactly the same issue, but in that case the problem could be solved simply extending some components).

 

Thank you and regards,

Link to comment
Share on other sites

they are as important fields so you should not exit them without introducing one correct value, so it refocus itself again.

That is a very very very BAD behaviour and should be avoided at all costs when designing any UI, especially in web. Have you ever seen such forms on any of major sites? Google? Microsoft? Facebook? Yahoo?... Anywhere? I guess not because it is a blocking design, and you should never block a user inside a field/form/any UI element.

If you want a server-side validation, do it when user clicks Submit/Save/OK button.

If you want a sequential validation then disable/hide some input elements until the correct value is given.

Link to comment
Share on other sites

That is a very very very BAD behaviour and should be avoided at all costs when designing any UI, especially in web. Have you ever seen such forms on any of major sites? Google? Microsoft? Facebook? Yahoo?... Anywhere? I guess not because it is a blocking design, and you should never block a user inside a field/form/any UI element.

If you want a server-side validation, do it when user clicks Submit/Save/OK button.

If you want a sequential validation then disable/hide some input elements until the correct value is given.

Although it may seem incredible, but not always have the luck to choose how to do some things

Link to comment
Share on other sites

  • Administrators

Although it may seem incredible, but not always have the luck to choose how to do some things

 

There is no way to lock user inside a edit field in a web form. As Zilav said I also don't consider this as good UI design.It is better to validate field when user posts the whole form.

Link to comment
Share on other sites

That is a very very very BAD behaviour and should be avoided at all costs when designing any UI, especially in web. Have you ever seen such forms on any of major sites? Google? Microsoft? Facebook? Yahoo?... Anywhere? I guess not because it is a blocking design, and you should never block a user inside a field/form/any UI element.

If you want a server-side validation, do it when user clicks Submit/Save/OK button.

If you want a sequential validation then disable/hide some input elements until the correct value is given.

 

Hi,

 

I agree with you Zilav and Farshad .. you're right.. but what is your opinion on this scenario:

 

There is a simple registration form activities. For each activity there is a field for the user to inform the customer, related to the customers entity.

 

To this i see two alternatives:

 

1) On the registration screen, create a field for the customer number with a button for a auxiliary consult(other screen), where the user can inform the customer number without consulting, or performing a consult through this screen.

 

Point Positive: With an auxiliary screen, you can have multiple forms of information search and filters, with only customers according to a pre-selection(essential for Web).

 

Negative point: You need to validate the output of the field, because the user can enter an invalid client number, without using the query screen auxiliary.

 

2) Not having query screen customers, but have a ComboBox for the user to enter the initials of the client's name and the ComboBox will present the names found in the database.

 

Point Positive: No need for field validation.

 

Negative point or Requirements: You will need an efficient way to show customers every change of text entered by user, as does most of the sites. Need to be careful because it will be necessary to provide multiple requests to the server or perform some caching process for the client side.

 

If the second view is the most appropriate, any idea how to accomplish it?

 

Thanks

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...