Alpha Video Training
Results 1 to 5 of 5

Thread: "On change" event with list box

  1. #1
    Member
    Real Name
    Nick Oldfield
    Join Date
    Aug 2008
    Posts
    344

    Default "On change" event with list box

    I have a field on a form, set up from a global variable var->vcustname. The field uses a control type of record list-list box, so there is a dropdown of customer names. The user selects the customer, and this is stored in the variable.
    There are a couple of other fields on the form, input by the user - the sales reference number, and a notes field. Whenever the form is opened, I want the previous values of the ref number and notes to be the same as the previous data, unless the customer changes, then I want to blank the ref number and notes fields. So I attach an action to the "onchange" event, to blank the fields. Unfortunately the "onchange" event fires even if the customer does not change. My guess is that just placing focus on the customer field forces a customer name into the variable, and triggers the "on change" event even if the customer name is the same. I know I can work around this by storing the initial customer name on the "oninit" event, and then checking on the "onchange" event to see if it has in fact changed, but it just seems like odd behavior to me.
    Any thoughts?

  2. #2
    Member
    Real Name
    Nick Oldfield
    Join Date
    Aug 2008
    Posts
    344

    Default Re: "On change" event with list box

    Bump. So is this a bug, or is it supposed to work this way?

  3. #3
    "Certified" Alphaholic Tom Henkel's Avatar
    Real Name
    Tom Henkel
    Join Date
    May 2002
    Location
    New Jersey, USA
    Posts
    1,873

    Default Re: "On change" event with list box

    Nick, you may want to do a trace to see exactly which events are firing when you click into the field. You also may want to do the check in the on-depart event, where you could check the original value against the "new" value.

    In an on-arrive event, capture the value in the field, then in the on-depart event, compare to what was there in the arrive event and if different, blank out the other fields when you depart.

    Tom

    We ran some traces on fields when developing forms, and there were a significant number of events fired that we didn't anticipate.

    Tom
    Last edited by Tom Henkel; 05-10-2012 at 12:36 PM. Reason: dislesic fingers

  4. #4
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default Re: "On change" event with list box

    Nick, it does sound odd. But I don't have an example here to study. Will be happy to corroborate your observations if that would help.

  5. #5
    Member
    Real Name
    Nick Oldfield
    Join Date
    Aug 2008
    Posts
    344

    Default Re: "On change" event with list box

    Tom (Henkel)- my workaround is that I'm now saving the original value in the "oninit" event on the form (yes, "onarrive" for the field would be more logical), and then checking when the "on change" event fires to see if it has in fact changed. The "on change" event is firing whenever I tab into the field. Maybe it's because the form field is a variable., not based on a table.

Similar Threads

  1. Dialog 2: Set Iframe "IFrame URL" in the "onDialogInitialize" Server Side Event
    By dionmccormick in forum Application Server Version 11 - Web/Browser Applications
    Replies: 0
    Last Post: 02-13-2012, 10:38 AM
  2. Problem Using "Prompt Using Check list Box Dialog" and filtering
    By cnfuzzd in forum Alpha Five Version 10 - Desktop Applications
    Replies: 3
    Last Post: 05-05-2011, 06:40 AM
  3. How do I change license # from "Run Engine" to "Platinum"?
    By Parish Mills in forum Alpha Five Version 9 - Desktop Applications
    Replies: 2
    Last Post: 11-19-2009, 12:15 PM
  4. "Drop Down List Box" behavior
    By ronwills in forum Alpha Five Version 5
    Replies: 3
    Last Post: 09-02-2003, 09:23 AM
  5. Field-type "Check Box:List Box"
    By Jon Pfarr in forum Alpha Five Version 5
    Replies: 4
    Last Post: 08-28-2002, 10:28 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •