• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Form Entry Event Trigger

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Form Entry Event Trigger

    I've currently got a form field that is going to be populated by a barcode scanner at which point we want it to do some processing. Is there a way to trigger the processing to occur without sending some sort of "Enter" key or button click? One method I was thinking could be used is if I could trigger some action once a certain number of characters have been entered into the form field for instance.

  • #2
    Good question. There is nothing built in to handle this right now. We could probably get this working using an "Execute Script" behavior action.

    What exactly needs to happen once the scan takes place? Filter widget(s), call a program, etc..?

    Comment


    • #3
      FYI - this sounds like functionality that we may want to integrate into NAB so moving this thread into feature requests.

      Comment


      • #4
        Originally posted by sean.lanktree View Post
        Good question. There is nothing built in to handle this right now. We could probably get this working using an "Execute Script" behavior action.

        What exactly needs to happen once the scan takes place? Filter widget(s), call a program, etc..?
        For this particular program, I'd want to call an RPG program to do some validation and database updates.

        Comment


        • #5
          OK, this is a total work around for now but should give you what you need.

          First, create a new button against your form and mark it as "Initially Hidden". This button will always be hidden but we are using it to process your events. In my case, I am setting the text of the button to "_hidden_".

          Next, add whatever events/actions you want to the click of this button.

          Next, click the settings icon for your form (when you hover over the form) and give it a name (available on the left side form). In my case, I am calling my form "customerForm".

          Last, open Behaviors and add the "Execute Script" action to the "Startup". See script below. Obviously, substitute customerForm, MYFIELD, and length as needed.

          Code:
          var form      = getWidget('customerForm'),
              myField   = form.down('[name=MYFIELD]'),
              hiddenBtn = form.down('button[text=_hidden_]');
          
          myField.on({
            change : function(cmp,val){
              if (val.length === 4){      // # of characters in the field
                btn.click();
              }
            }
          });
          
          success();

          Comment


          • #6
            I'll give that a shot. Thank you. Also, that should be
            Code:
            hiddenBtn.click();
            instead of
            Code:
            btn.click();
            right?

            Comment


            • #7
              Ahh, yes, you are correct.

              Comment

              Working...
              X