pbServerOnFocus - cWebBaseControl

Controls whether the OnFocus event is sent to the server when the control receives the focus at the client

Type: Property (Web Property)

Access: Read/Write

Data Type: Boolean

Parameters: None

Syntax
 { WebProperty=Client }
 Property Boolean pbServerOnFocus

Web Property Read Access: WebGet pbServerOnFocus to BooleanVariable
Web Property Write Access: WebSet pbServerOnFocus to BooleanVariable/Value

Read Access: Get pbServerOnFocus to BooleanVariable
Write Access: Set pbServerOnFocus to BooleanVariable/Value


Description

When the application user moves the focus from one control to another (by clicking or tabbing away from a control), then it is possible to trigger an OnFocus event at the server for the DataFlex object that represents the control that receives the focus.

Whether or not this event is sent to the server is controlled by the pbServerOnFocus property. When True, the OnFocus event will be sent to the server object when it receives the focus. By default, pbServerOnFocus is False.

You should try to avoid using server-side OnBlur and OnFocus events. They can be complicated to use and inefficient if used often.

Imagine if you had a view where every control sent OnFocus to the server when it received the focus and OnBlur when it lost the focus. This would mean that navigation from one control to another would send two calls to the server to process these events. Remember that each server call requires synchronization of the view's web properties and data dictionary objects. Since separate calls can be handled by different web application instances in the server's process pool, it means that it is possible for the OnFocus event of the control you are navigating to will finish before the OnBlur event of the control you navigated from. These are some of the issues you need to understand and consider when using server-side OnBlur and OnFocus events.

Often you can design your web application to avoid relying on OnBlur or OnFocus events. If there is no alternative then you should consider using the client-side OnBlur and OnFocus events instead. Client side events are processed without the overhead of a server call and there are no latency or out-of-order issues to consider. The disadvantage of client-side events are that they need to be coded in JavaScript and you do not have access to any server-side resources or data. See psClientOnBlur and psClientOnFocus for more information.


About Web Properties
Each web property maintains two values: The regular property value is set during object creation and should not be changed during the lifetime of that object. To access that value, use the standard property Get and Set syntax.
The web property value is the local value stored at each client. This is synchronized to the client's local value whenever a server call is being processed. To access the web property value, use the WebGet and WebSet syntax above instead of the standard Get and Set syntax.
See Also

pbServerOnBlur