Home > Ask the Domino Experts > Questions & Answers > How can I capture a user's change to a dialog list and use the input to run a process?
Ask The Domino Expert: Questions & Answers
EMAIL THIS

How can I capture a user's change to a dialog list and use the input to run a process?

Andre Guirard EXPERT RESPONSE FROM: Andre Guirard

Pose a Question
Other Domino Categories
Meet all Domino Experts
Become an Expert for this site
>
QUESTION POSED ON: 13 October 2003
I have a form with one field, which is an editable dialog list. The contents of the list are unimportant, except that there is more than one choice.

The dialog field is defined as "Refresh fields on keyword change," "Refresh choices on document refresh" and "Display entry Help button." So far we are very standard drop-down list, right?

I have another field on the form that is hidden (the user cannot interact with it). I want to compute some value to be placed into this hidden field when the keyword in the field changes. The trick is that the computed text in the hidden field is going to show or hide an action button also on this form.

In other words, I want an event to occur when the user changes a dialog list, which I can capture and then process something without the user interacting with the screen in any other way.

I know about an onExit event, but this assumes that the user has moved out of the field, which is not the case. I know about an onEntry event, but the user has not made a change yet. I know that I could process the document (and fields it contains) when the user clicks the Action button -- but the button is hidden until the user has made their choice.

How do I do it?


>
The "Refresh fields on keyword change" option does trigger immediately when the field value changes, not waiting for you to exit the field -- provided the field keywords are of the "Enter choices" or "Use formula" type. The hide formula for your action button should recalculate immediately when the keyword field changes. Action hide formulas calculate after all the fields, so the newest value of your computed field should be used. I tested it myself with a simple form; here it is:
Field:        AKeyword 
Datatype:        Keywords 
Field Type:        Editable 
Keyword User Interface:      
  Standard 
Allow Values Not In List:     
   No 
Allowable Keywords:        A 
        B 
        C 
Field:        Acomp 
Datatype:        Text 
Field Type:        Computed 
Formula:        @If(AKeyword =
 "B"; "1"; "0"); 
Action:        peekaboo! 
Formula:        @Prompt
([Ok];
 ""; "Peekaboo!"); 
Hide formula:        AComp != "1" 
If you need this functionality with a field that is not an "Enter choices" or "Use formula" keyword field, while there is no event that you can program to trigger as soon as the field changes.

However, you can use a NotesTimer object to check periodically -- say, once every second -- whether the field value has changed; if it has, you refresh the form. Add code to the form Postopen and Postmodechange events to notice when someone has started to edit the form; read the current field value using NotesUIDocument.Fieldgettext and store that in a global, then start the timer. In the NotesTimer event handler, use Fieldgettext again and compare with the stored value. If it's changed, refresh the form.

Warning: Refreshing the form can potentially take more than a second, especially if the form contains some @DB functions. You should disable the timer while doing the refresh, because if another timer event happens while you're processing the previous event, the Notes client will crash.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Lotus Notes Domino on Blackberry and mobile devices
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts