This discussion is archived
5 Replies Latest reply: Dec 9, 2013 1:12 AM by Cvele_new_account RSS

set attribute in EO validation

newbee Newbie
Currently Being Moderated

Hi

(JDEV 11.1.1.7)

I want to control validation of a field in EO .

so i , in validation rules of EO , create for sightly field a validation rule by method .

in java file EOViwImpl added a method that return boolean . its OK .

NOW i want set value of another field of EO by some values .(for example description = "this error is related to .......")

ok i write : setDescription ("this error is related to .......");

it hasnot any error on runtime .

but on the UI dosnt refresh its field .


Do i set its value in right manner ?

if yes . How can i refresh its UI component ?


Thanks .

  • 1. Re: set attribute in EO validation
    Cvele_new_account Expert
    Currently Being Moderated

    Tried to test with BC component tester ?

     

    Set autosubmit to the true for the component you want to validate, and set partial trigger for the Description ui component, to be first comp. By the way, there is no need to set another field value, set just an error message, and it will be displayed to the user.

  • 2. Re: set attribute in EO validation
    newbee Newbie
    Currently Being Moderated

    Hi

    Tried to test with BC component tester ? YES .

    I did , set autosubmit to true  and partial trigger of description to component BUT

    descrption didnot refresh !!!

    thanks

  • 3. Re: set attribute in EO validation
    Cvele_new_account Expert
    Currently Being Moderated

    its possible that this is normal behavior when an validation error occurs (the second component does not refresh), to tell you truth I am not sure.



    What happens while you test with BC tester ?

    If the second component refresh ?

  • 4. Re: set attribute in EO validation
    newbee Newbie
    Currently Being Moderated

    What happens while you test with BC tester ?

    its same as web page test . didnt do any refresh .

     

    Cvele_new_account , i want to pass some values from UI (web page) to method of validation rules ,

    but apparently i cant pass any valu to EO !?

     

    How can i validate value of a field , when i  cant pass ui component values to EO , VO of  Model layer ?

    I tried to validate its value in returnPopupListener of ui component BUT i cant control bad values !!!

     

    Thanks

  • 5. Re: set attribute in EO validation
    Cvele_new_account Expert
    Currently Being Moderated

    try to override setAttributeInternal() method in your EntityImpl class as follows:

     

    protected void setAttributeInternal(int index, Object val) {
         try {
            super.setAttributeInternal(index, val);
         }catch (AttrSetValException e) {
             if (e.getAttrName().equalsIgnoreCase("AttrYouNeedToValidate"))
                 setDescription ("this error is related to .......");

     

             throw e;
         }

       }

     

    and let me know what happens (of course, change "AttrYouNeedToValidate" with name of actual attribute)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points