Alpha Video Training
Results 1 to 8 of 8

Thread: onBeforePanelActivate Fires after Cilent-Side Validation

  1. #1
    Member
    Real Name
    Joe Lavely
    Join Date
    Jun 2013
    Posts
    419

    Default onBeforePanelActivate Fires after Cilent-Side Validation

    I have a attached simple UX to demonstrate this.

    There is a PanelLayout, with a PanelNavigator and a PanelCard, and a TextBox control.

    The textbox has ValidationRules set to "Require Value"

    In PANELNAVIGATOR_1, onBeforePanelActivate event I added alert('onBeforePanelActivate');

    When the textbox becomes dirty, the validation fires and the alert fires.

    Am I doing something wrong, or is this a bug?

    Build 5887-5315
    Attached Files Attached Files

  2. #2
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,572

    Default Re: onBeforePanelActivate Fires after Cilent-Side Validation

    Looks like a bug to me.

    To be more specific about your test... it's not when the textbox becomes dirty. It's when you click into the textbox, and then tab out of the textbox... without entering anything into the textbox.

    Since the textbox is set to "Require Value", you get an error message in red about the text... and onBeforePanelActivate fires. Sometimes the textbox error happens first... sometimes the onBeforePanelActivate happens first... it's a toss up which fires first.

    There should be no relationship between textbox validation and onBeforePanelActivate. onBeforePanelActivate should not be firing since there is no other Panel to go to.

  3. #3
    Member
    Real Name
    Joe Lavely
    Join Date
    Jun 2013
    Posts
    419

    Default Re: onBeforePanelActivate Fires after Cilent-Side Validation

    Bug report submitted.

  4. #4
    Member jgrannis's Avatar
    Real Name
    Jeff Grannis
    Join Date
    Apr 2016
    Location
    New Iberia, LA
    Posts
    339

    Default Re: onBeforePanelActivate Fires after Cilent-Side Validation

    I think I just found the same sort of thing, but in my case, I am getting stuck on in a textbox that has no type of validation configured. Also testing my app with build 5887-5315.

    I have console.log'ing in each of my Panel navigator "PanelActivate" events and I only see the onBeforePanelActivate event getting triggered. I don't understand this because none of the code involving this textbox has anything to do with navigating to a different panel.

    Thanks for having submitted a bug report for us.

  5. #5
    Member
    Real Name
    Joe Lavely
    Join Date
    Jun 2013
    Posts
    419

    Default Re: onBeforePanelActivate Fires after Cilent-Side Validation

    Below is Selwyn's reply to my bug report. I have not yet tried to see if his solution will work in my app, because I believe that if onBeforePanelActivate fires, the onSwipe event for the PanelCard does not fire. So I need to work on it.


    From Selwyn:
    ...there is an easy change you can make to your code to achieve this


    if(this.state.activePanel != arguments[0]) {
    alert('onBeforePanelActivate');
    }
    return true;


    it is "sort of" a bug.

    there is built in code in the UX to set focus to the control where an error has occurred.

    for example, imagine a ux with two panel cards inside a panel navigator.

    say that Card 1 has a control called "text1" and it has a rule that says must not be blank.

    say that Card 2 has a submit button.

    say you run the component, leave the control on Card 1 empty, go to Card 2 and hit the submit button.

    this will cause a validation error (on the text1 control on Card1), but focus will be on Card2.
    so we set focus back to Card 1 so that you can see the error.

    the bug is that we should enhance the UX so that the panel navigate events do not fire if you set the active panel to a panel that already has focus.

  6. #6
    Member
    Real Name
    Joe Lavely
    Join Date
    Jun 2013
    Posts
    419

    Default Re: onBeforePanelActivate Fires after Cilent-Side Validation

    I am not sure of which events should fire, and in what order, between the PanelCard and the PanelNavigator. I would like to know.

  7. #7
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,572

    Default Re: onBeforePanelActivate Fires after Cilent-Side Validation

    The order of events isn't documented... should be.

    It's fairly easy to find out. For each of the events in a Panel Navigator and PanelCard put code like this... detailing each event.

    Code:
    console.log('PN1 onCreate');
    Code:
    console.log('PC1 onCreate');
    For a simple UX, 1 PanelNavigator, 1 PanelCard, this is the order of events for just the UX displaying. onSize is firing a lot because I'm viewing the console.
    It's interesting that the PanelNavigator is firing after the PanelCard.

    PN_PC_Event_Order.PNG

  8. #8
    Member
    Real Name
    Joe Lavely
    Join Date
    Jun 2013
    Posts
    419

    Default Re: onBeforePanelActivate Fires after Cilent-Side Validation

    I solved my issue.

    I need the controls in a particular panel to be validated client-side. Some of the validation is conditional on values in other controls, so I am firing validation code in the onSwipe event of the panelcard.

    Then if the validation has no errors, I have code in the panelnavigator onBeforePanelActivate that fires an xbasic function to save the values to a table.

    The problem was that I was using javascript alerts to determine if events were firing.

    Using the console.log as David posted (thank you David) shows that when a the user swipes, the onBeforePanelActivate fires before the onSwipe event.

    If there is an alert in onBeforePanelActivate , it will prevent the onSwipe event from firing.

    So the alert itself was causing my issue.

Similar Threads

  1. client-side validation
    By christappan in forum Mobile & Browser Applications
    Replies: 13
    Last Post: 10-03-2014, 01:56 PM
  2. Client Side immediate validation JavaScript Required. NB!!!
    By Corne in forum Mobile & Browser Applications
    Replies: 35
    Last Post: 11-25-2013, 03:36 AM
  3. How to get the field name in a Client-Side Validation
    By bavism in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 04-02-2013, 10:04 PM
  4. Client side date validation
    By RhinoSmith in forum Application Server Version 11 - Web/Browser Applications
    Replies: 10
    Last Post: 03-18-2013, 09:48 AM
  5. client side validation for a grid
    By martin horzempa in forum Web Application Server v6
    Replies: 2
    Last Post: 10-17-2005, 04:01 PM

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
  •