Forum Stats

  • 3,826,359 Users
  • 2,260,635 Discussions
  • 7,896,916 Comments

Discussions

How faces messages stop the user action

User_BUYLR
User_BUYLR Member Posts: 42 Green Ribbon

Hi Team

jdev: 12.2.1.2.0


As per our requirement we need to add few validations based on other components

so we are doing validations in value changes listener and adding error messages to component


but it's not stopping user to save the record




value change listener code :




But user is able to save the record even though we thrown the error to that particular component


can anyone suggest me here how to stop the user until he /she correct the data


Note: we tried with validator but it's not executing properly

example: if my expiration date is 16th June 2022 and we are trying to give 17th June 2022 as part expiration date then it's throwing error (it's good) but it still giving error when we go back to expiration date and change the date as 30th June 2022

due to this we moved validation code to valuechange listener

Best Answer

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,457 Red Diamond
    Answer ✓

    Well, I gave my suggestion and in the end, you'll see that it works this way. Why does it matter if they are customer validations?

    Your application has to make sure that they are enforced. The customer should not allow you to write wrong data into the DB. Only a DB validation can ensure that.

    As I said, you can and should validate in the UI, but you have to make sure the data written into the db is correct.


    Timo

Answers

  • dvohra21
    dvohra21 Member Posts: 14,573 Gold Crown
    edited Jun 16, 2022 3:09PM

    Not the value change listener, but code validation in ADF BC View Object Before Commit Method beforeCommit(). If your beforeCommit() logic can throw a ValidationException, you must set the jbo.txn.handleafterpostexc property to true in your configuration to have the framework automatically handle rolling back the in-memory state of the other entity objects that may have already successfully posted to the database (but not yet been committed) during the current commit cycle.

    For detail please refer https://docs.oracle.com/middleware/1213/adf/develop/adf-bc-validation-events.htm

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,457 Red Diamond

    This kind of validation belongs to the model layer. If you add this validation to the EO attribute and throw the error there, the data will not be saved.

    Doing the validation in the UI is OK as you avoid the server roundtrip, but in the end, you have to do the validation before committing the data. My assumption is that the DB will do this validation again to make sure that only valid data is stored in the DB.

    The validation in the DB is needed to avoid you (or any other developer or user knowing the DB) from changing the data into something that is not valid for your business.

    Timo

  • User_BUYLR
    User_BUYLR Member Posts: 42 Green Ribbon

    Hi Timo ,


    Thanks for your response.


    These are customer validations (these should be get/prompted immediately ) and Data base doesn't have any validations

  • User_BUYLR
    User_BUYLR Member Posts: 42 Green Ribbon

    can anyone suggest me here

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,457 Red Diamond
    Answer ✓

    Well, I gave my suggestion and in the end, you'll see that it works this way. Why does it matter if they are customer validations?

    Your application has to make sure that they are enforced. The customer should not allow you to write wrong data into the DB. Only a DB validation can ensure that.

    As I said, you can and should validate in the UI, but you have to make sure the data written into the db is correct.


    Timo