Error shows too early

  • Tomas

    Tomas - 2008-11-12

    I use version 1.9 and I see the following problem.

    I have a very simple form that allows to enter person contact information. The user must select the "person" using the poplist and then the "contact type" via poplist and then add the "value". All fields are required. When I open this form all looks good but when I click on first poplist to select a person the "value" field shows and error "Value is Required" and the cursor jumps there. Is it possible to change this validation to the point when the user clicks "Save".

    • Patrick Wolf

      Patrick Wolf - 2008-11-12

      Hi Tomas,

      I think the reason is that APEX doesn't set the cursor focus to the first field (person), instead it puts the focus into the "value" field. ApexLib does the required check as soon as the user leaves a field that's why you get the error message.

      You have two possibilities.

      1) Set the page attribute "Cursor Focus" to "Do not focus cursor" and add the following code into the "Footer Text" attribute to correctly set the focus into the first field.

      <script type="text/javascript">


      2) Open region "ApexLib - Before footer" on page 0 and set the parameter pShowRequiredWarning of the ApexLib_Browser.initValidation call to FALSE
        ( pShowRequiredWarning => FALSE

      This will prevent the immediate required check when the cursor leaves the field. The check will still be done when you submit the page.

      Hope that helps

    • Tomas

      Tomas - 2008-11-12

      Awesome, thanks for the tip - I try it later today.

    • Tomas

      Tomas - 2008-11-13

      Kind of worked but there is another problem.

      I like when the items are validated right away, however, pressing the "Cancel" button raises an error, then pressing it second time actually cancels the form.

      I disabled the validation on Page 0, however I'm curious if there is anyway to have it ignored the "Cancel" action.


      • Patrick Wolf

        Patrick Wolf - 2008-11-14

        Hi Tomas,

        the problem is that when the cursor is in a field and you press a button the focus is moved out of the field and the required check is triggered. If the error message is displayed in the notification area, the button you pressed will most time be moved a little bit and the browser forgets that you just pressed that button because it's not below the mouse cursor anymore. That's why you have to press the button a second time. I don't really have a solution for that yet.



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks