Salesforce

How Do I Retrieve the New value of an Edit Control While Handling Its Events? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Retrieve the New Value of an Edit Control While Handling Its Events? (Magic xpa 3.x)

By default, when a handler executes while the cursor is sitting on an edit control, the value of that control has not yet been read. That means that even though the user has in fact typed in a new value, that new value does not exist in the variable until the user leaves the field.

This can be an issue for handlers that are called via a control key. Suppose, for instance, we have a calendar that pops up when the user presses F9.

The default date was 01/01/1901. We typed in 12/12/1999 and pressed F9. But our handler picked up the original date, 01/01/1901. This is obviously not how we want our program to work!

To change this, we change the Force Exit column in the user event.

Using Force Exit = Editing will cause the engine to leave Edit mode, update the variable with the edited value, and recompute any values related to the updated variable, before executing any handlers.

Now, the date will get passed as expected.

Hint: The Force Exit property only applies to user events. If you need to add force exit to a system event such as a keystroke, you need to enter it as we did here, using the system event to trigger a user event.

Note: A calendar program is often attached to a date model using the Select program property of the model, in which case the date field is automatically passed in the “user modified” form. However, using logic units gives you more options. For instance, F9 might bring up a plain calendar selection, but F10 might bring up my whole Outlook schedule.

See also

The Online and Rich Client Samples projects (program EN07 and REN07)

Reference
Attachment 
Attachment