Triggering Validation in a Region Through a Contextual Event

I am using JDeveloper 11.1.1.6.0.
I am trying to find out how to trigger the built in validation that occurs normally when a "submit" action occurs, but have the submit action occur outside of a region, and the validation also occur in the region itself.
I have a page that contains a dynamic region in it. I will refer to the containing page as the parent and the region as the child. The parent region and child region both have different business objects bound to them, though they are part of the same application module. The parent page contains a submit button that needs commit the user entered data in both the parent and child pages. This action must not proceed if there are any validation errors in the parent or the child. The validation should trigger on the parent page without any work from me because of how ADF handles the situation. The child page is notified of the submit action via contextual events. I currently have it where this event can trigger the "commit" action successfully, but I have no idea how to go about ensuring that it triggers a validation check as well.
The overall flow that I think will happen in the final version is likely:
1: submit button pressed.
2: parent page validation is checked (if success, proceed)
3: contextual event is fired
4: contextual event is received by the child.
5: the child triggers its own validation (if success, proceed, else stop)
6: the child triggers a commit action
7: the child sends a response contextual event (signalling that it was successful)
8: the parent receives the response contextual event
9: the parent performs a "commit" action.
I do not know how to cause step 5 to occur, and I do not know if steps 7 through 9 are needed yet (I haven't tested to see if causing the commit in either the parent or the child ends up causing all modified entity objects to be committed). Any help would be greatly appreciated.
Thank you

Hi,
you can access a command button on the page fragment and queue its action event. For this you access a managed bean (backingBean Scope) that contains a handler to the command button and queue the event (this then will perform validation as if the user clicked it. The command button can also be hidden on the fragment.
Have a look here for how you can integrate the managed bean as the contextual event handler
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/regionpayloadcallbackpattern-1865094.pdf
Frank

Similar Messages

  • Contextual event consumption

    Hello,
    I am using JDeveloper 11.1.1.7.0.
    So.. I have a page that contains a region. The region has a contextual event that is activated when the selected item from a drop down list is changed.
    I am consuming the event (in the page) in a java class (that is implemented as a data control).
    My question is, how can i change the value of a value from my page and also refresh (partialTrigger) the item? (my page has a bean class)
    Thank you.

    Hi,
    check this
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/regionpayloadcallbackpattern-1865094.pdf
    Frank

  • Communication through contextual events in ADF 11g?

    hi everyone ,
    I have a requirement that i have to establish a communication between two taskflows and communication between page and the two taskflows at a time through contextual events
    I'm able to establish a communication between two taskflow regions but when it comes to establish a communication between a page and two taskflows at a time the two taskflows are rendering but the region in page s not
    (when i click deptno in taskflow region ,the employee table is displayed according to the deptno in another taskflow and the region contains output text is not at all rendering according to the deptno)
    plz do this needful
    thanx in advance

    Hi,
    contextual events are between active PageDef files. This means that if a task flows is not displayed on a view, then it is not included in contextual event communication.
    Frank

  • Contextual event on table not triggered

    Using Jdev PS4.
    Concider following example: http://www.yonaweb.be/ContextualEvent.zip
    (I know following example can be simplified by using master-detail relation in the data control but it's to illustrate the example)
    I have two taskflows: EmployeeTF and departmentTf.
    The idea is to trigger an event when I select a new record in the department table.
    This is the tree binding:
    <tree IterBinding="DepartmentsIterator" id="Departments">
          <nodeDefinition DefName="model.views.DepartmentsView" Name="Departments0">
            <AttrNames>
              <Item Value="DepartmentId"/>
              <Item Value="DepartmentName"/>
              <Item Value="ManagerId"/>
              <Item Value="LocationId"/>
            </AttrNames>
            <events xmlns="http://xmlns.oracle.com/adfm/contextualEvent">
              <event name="changeTheDept"
                     customPayLoad="${bindings.DepartmentId.inputValue}"
                     eventType="Currency Change Event"/>
            </events>
          </nodeDefinition>
        </tree> I have created a custom java class to use as a data control to find out when the event is triggered. This is my code:
        public void handleEvent(Object payload){
            System.out.println("Event handler");
            System.out.println(payload);
        }When I select a record in the table, the event does not get fired.
    So as a test I added my own custom method to see if contextual events are working properly so I added this method to my DC:
        public void triggerEvent(){
            System.out.println("triggering event");
        }and added it on a commandLink to the DepartmentTF. I also added an event on it:
    <methodAction id="triggerEvent" RequiresUpdateModel="true"
                      Action="invokeMethod" MethodName="triggerEvent"
                      IsViewObjectMethod="false" DataControl="EmpBean"
                      InstanceName="EmpBean.dataProvider">
          <events xmlns="http://xmlns.oracle.com/adfm/contextualEvent">
            <event name="triggerEvent"
                   customPayLoad="#{bindings.DepartmentId.inputValue}"/>
          </events>
        </methodAction>When I trigger this event, my event handler does get called on the employee taskflow.
    So, my question is:
    1) Is this normal behavior that the change row event is not triggered?
    2) if yes, how do I trigger it or what is the purpose of this event?
    Edited by: Yannick Ongena on May 28, 2012 9:03 PM

    I have a similar circumstance: I have a page with two regions, each region contains a table. The two tables share some information so when I update one of them
    I also want the change to be reflected in the other table. I tried to use contextual events to send an event that causes one of the tables to refresh (I do not pass any payload)
    but so far I have not had any success with making this work. I am wondering if the bug you mentioned here would also prevent such a setup to work? I am using Jdev 11g R1 11.1.1.6.2.

  • How to publish contextual event from dynamic region

    Hi Experts, plz help.
    Scenario :
    I have a page , say Page A.
    I have two bounded task flows, say HeaderTF and LinesTF.
    HeaderTF is placed as a static Region in page A and LinesTF is a dynamic region in page A.
    LinesTF has a table with Amount Column.
    HeaderTF has a text field which shows the total of amount column.
    Requirement :
    when user adds new rows or changes existing rows or deletes any rows in LinesTF, total field in HeaderTF should be updated.
    On change of amount value in lines, I am calculating and updating the total attribute of header VO as all of them are sharing same DC.
    but the value is not reflecting becos partial triggers cannot be kept for total field.
    So I am using contextual events.
    I created a contextual events for amount field, delete button and table as well (In LinesTF).
    and I created handler method in AM which calculates total and dragged it as a text field in HeaderTF.
    Now when I am trying to subscribe from pagedef of pageA, i am able to find the handler which is created in HeaderTF but could not find any contextual events in event lov.
    Question :
    1. Is my approach correct?
    2. Cant we publish contextual events from dynamic regions?
    3. Is there any alternate way of achieving this?
    I did not try refreshing HeaderTF by passing input params because I dont want the entire region to be refreshed.

    Try creating the event mapping - please see "28.7.2 How to Create Contextual Events Manually" in Dev Guide http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/web_adv.htm#CACJBFGI

  • Validation of a Region defined as type SQL QUERY (Updateable Report)

    Hi,
    I am trying to perform some validation on a Region defined as type SQL QUERY (Updateable Report). The report has two columns.
    One of the columns is a Select List and I would like to insure that a user cannot select the same value twice
    in the report. For example, if the select list has 5 values, A, B, C, D, E, I don't want a user to be able to select
    B twice in the report. I am assuming that I will need to incorporate javascript
    into my validation logic in order to perform this task. If so, could someone provide some guidance? Or are there
    other alternatives.
    Thanks in advance,
    Michael

    Dan,
    Sorry, I didn't mean to post the question twice. I was trying to edit my original question. Thanks for the link to the website. I am new to APEX development so the website you gave me will be extremely useful to learn new development techniques.
    Thanks again,
    Michael

  • Contextual Event Automatically refreshing child regions

    Hello,
    Here's my dilemma. We have an ADF page fragment that contains three regions(which point to 3 different bounded task flows). Lets call the bounded taskflows btf1, btf2, and btf3.
    What currently happens is we use contextual events to create communication between (btf1 and btf2) and communication between (btf2 and btf3)? We do not have contextual event that would allow communication between btf1 and btf3.
    So we currently have this communication working. Hence, when I hit a button in btf1, it fires off a contextual event, such that btf2 is refreshed. But what is happening here, is that btf3 is also being refreshed. We DON'T want THIS... We only want btf3 to be refreshed from an event that is fired from btf2.
    Question. Is there a way to restrict ADF from refreshing btf3 everytime and event is fired from btf1.
    In general, it seems as though all regions are being refreshed everytime a contextual event is fired. We don't want this. How can disable this from happening? We have checked all of wiring. There is no connection between btf1 and btf3.

    Try creating the event mapping - please see "28.7.2 How to Create Contextual Events Manually" in Dev Guide http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/web_adv.htm#CACJBFGI

  • How to subscribe contextual event rised in a Dynamic Region

    Hi all,
    i can subscribe contextual event rised in a region.
    but when it comes to Dynamic Region, i cannot find available contextual event in the "Select Contextual Event" dialog.
    Is there a way to subscribe contextual event rised in a Dynamic Region?
    Thanks

    Hi,
    for dynamic regions you don't subscribe to a contextual event producer but only the event name (which you type in). The producer name will then be wildcarded '*'. The visual dialog will shows <Empty> by default, indicating a wild card provider.
    Frank

  • Regions & contextual events

    Hi,
    I am trying to rebuild an 10g webcenter application that used portlets and inter-portlet communication. The use case I have is:
    - one task flow where we have a bpel task list. User can click a task to select it
    - selecting the task should transmit the task type and id to the main page
    - another task flow on the page should, depending on the task type, be shown with id as an input parameter.
    Can this kind of a dependency be created, and if so, how?
    Regards,
    Jeroen van Veldhuizen

    Hi,
    is taskflow "one" a region? If yes then this would require a contextual event to propagate the selection and the payload. You could then set a vaue e.g. in a managed bean and issue a PPR on the region that should show based on the value.
    An alternative to using contextual events would be to use JavaScript. JavaScript in a region can be used to call components on the parent page. The drawback of using JavaScript tough is that it tightly binds th regions to the page, which means you loose the loose coupling. So contextual events may look better (though it comes with more overhead)
    Frank

  • "Region Mismatch.  This merchant account is not valid in this region." PayPal Here

    Hi Guys
    I use the paypal here system via card-reader and 4s with ios 7.0.2.  I've been trying to process a customers payment since friday but i keep gettin error message saying "Region Mismatch.This merchant account is not valid in this region".
    I have contacted PayPal who do not have a problem like this listed in their error database, they suggested checking the "locations" setting in privacy which I did - I have all green buttons there and little compass pointer at the side of the apps using location paypal has this little symbol against it, re-loading the App as it maybe a problem with ios7 (not surprising as it has already screwed up my on-line banking app causing me to have to re-register the whole service).  This I have done, I have switched off and re-started both the card reader and the phone.  All to no avail.
    paypal have now escalated the problem to their technical people but was just wondering if anypne else has experienced a problem with location errors?
    Thanks for any input, particularly from any Apple rep[resentatives who pehaps monitor this forum.  I do resent having to pay £25 for support.
    Bob

    Hi fromsouth, obviously I don't know who you are, you say you are just a user so I shall try not to become personally abusive as that serves no useful purpose and merely goes to alienate potentially helpful readers so perhaps I should re-word my statement on support.  I resent paying for support to the company which is directly responsible for the problem for which I am seeking support. On Googling, it is manifestly obvious that Apple has screwed many apps with the issue of ios7 - my fault for trusting Apple (which I have always previously done) and downloading the os before checking if it was any good or not.  At least with Windows 8 one has the option of reverting back to W7 - Apple have gone one better than Windows - not only have they produced an "update" in which I have frankly yet to find a benefit - but they have made it so that if you don't like it well screw you - you're stuck with it.  Whatever happened to customer service and satisfaction.  ****, not only did they fail to put in an easy method of deleting multiple email messages, they've even blocked the workaround that had been found in os6.
    Contact the reader manufacturer?  - Why should I have to?  It worked fine before ios7 - now it doesn't!!  Try this scenario - I have a car which is working perfectly - I go to a garage to get fuel, the fuel contains contamination and my car won't start - is that the car manufacturers fault - of course not- it's the supplier of the fuel!   That should make it Apple's problem to solve but Apple are so arrogant that they just do whatever they like and everyone has to follow and spend fortunes re-writing their software to suit the whim of Apple's designers.
    I've always defended Apple in the past during arguments contra Windows and Android but I'm afraid this is now beyond the pail - minor inconveniences one can accept and tolerate - but when something as fundamental as this which actually prevents me from conducting my business normally - I think you can understand my anger and frustration and believe me what is written here does not even scratch the surface.
    Thank you for your suggestion on the Apple feedback site - I shall most certainly go there and give it a whirl
    end of rant.................for now
    cheers
    bob

  • Contextual Event refresh/redraw issue between 2 regions (taskflow w/ jsffs)

    Working on JDev 11.1.1.2.0
    I have one jspx
    which contains 2 regions - bounded taskflow with jsffs
    Now, I want to communicate between region1 and region2
    so, producer is : region2pageDef and consumer is: region1pageDef, and Handler is pointing to a Java Bean Data Control , listening for ActionEvent
    Contextual events works fine as expected , but when region1 listenes the contextual event , at that time entire jsff gets refreshed / redrawn, why?
    How contextual event works from the ADF side ,and what causes it to redraw the page fragment
    Thanks

    When I have 3 dynamic regions on a jspx page, where every region loads taskFlow with jsff page.
    One of the pages produces the contextual event, the other receives the contextual event and the 3rd one does nothing.
    Then 3rd region is not refreshed. It works correctly.
    But when I place eventMap in the pageDef of the jspx page, then all regions are refreshed no matter if they receive the contextual event.
    This is not the right way. Why is that? Do you have an idea?
    I am using JDev 11.1.1.3.0
    Edited by: Nikolay Minchev on Dec 22, 2010 2:44 AM

  • Validation table for region/sales district/postal code combination

    Hi Folks,
    Is there any validation table for region/sales district/postal code combination? As I am looking for some standard functionality where a user if puts a wrong zip code/ postal code for a specifc city or country while creation of customer master then system should not allow and throws any kind of error or warning message.
    Please let me know if there is somethiong like this.
    I have some failt idea that we have something in standard SAP where we get a pop warning where postal code-country and postal code-city combination does not exist.
    Please let me know the transcation code and table name for that.
    Thanks and cheers,
    Sandy

    Hello,
    I'm not aware of any settings for this which include sales district.  For the rest a few spots to look at:
    -SAP NetWeaver>General Settings-->Set Country-Specific Checks (some controls for postal code per country)
    -SAP NetWeaver>General Settings-->Set Country-Insert Regions (country to region ties)
    ---Flexible Real Estate Management >Address Management>Regional Structure/City File-->Cities (have not worked with this area but you'll see several nodes for dealing with cities here).
    Hope this helps.

  • [SOLVED] Triggering a contextual event programatically

    Hi,
    Is it possible to raise a contextual event from within a managed bean code, without transforming that bean into a data control and defining a methodAction?
    Thanks,
    ~ Simon

    Hi again,
    I found it myself (thanks to decompilation), the required code is
    BindingContainer.getEventDispatcher().queueEvent(EventProducer producer, Object payload);Well I still need to figure out the exact semantic of the value returned by EventProducer.getEventDefinitionsList(), but hopefully I'm going to find that soon.
    Regards,
    ~ Simon

  • Contextual event in reverse direction ( from child TF to parent view )

    Hi ,
    It seems all example of Contextual events talk about mirroring input value from Parent page to Child TF running in a region and there are numerous examples out there.
    What I wanted to accomplish was that an lov in a child TF triggers a contextual event and the parent TF takes the selected list of values. It needs to conduct a search based on these values and than mark the rows in a (tree)table.
    What has succeeded is almost all aspects of this. I can fire the event and receive it successfully. But the problem is the the backingBean class that I create via EL is not binded to my parent pages components. The treetable component returns null.
    My handler code (the handler code from the bean which you use to create the data control to listen to the cntxtual event) is almost 1:1 to as the code from the book "Oracle Fusion Developer Guide: Building Rich Internet Applications with Oracle ADF Business Components and Oracle ADF Faces", Chapter 6, page 210.
    public void receiveEvent(
    DCBindingContainerValueChangeEvent incomingPayload){
    FacesContext fctx = FacesContext.getCurrentInstance();
    ELContext elctx = fctx.getELContext();
    Application app = fctx.getApplication();
    ExpressionFactory exprFactory = app.getExpressionFactory();
    ValueExpression valExpr = exprFactory.createValueExpression(
    elctx,
    //reference the managed bean that holds the mirror value
    //property displayed in the input text field
    "#{backingBeanScope.ConsumerBackingBean}",
    Object.class);
    ConsumerBackingBean consumer = null;
    consumer = (ConsumerBackingBean)valExpr.getValue(elctx);
    //get the changed attribute value from the contextual event
    //payload
    String newValue = (String)incomingPayload.getNewValue();
    //set the new value to the backing bean property that is
    //referenced by the input text field in View 3
    consumer.setMirrorValue(newValue);
    AdfFacesContext adffacesContext = null;
    adffacesContext = AdfFacesContext.getCurrentInstance();
    //partially update the text field to display the new value
    adffacesContext.addPartialTarget(consumer.getMirrorTxt());
    The #{backingBeanScope.ConsumerBackingBean} evaluates in my case to fine. But every component I should see as binding in the bean is null.
    Since the handler is declared in the pageDef of this parent page Fragment, i assumed the last bit about it being able to get to the backing bean and hence to my components should also be possible.
    If I cant refresh my components than I dont see the use of the contextual frameworks for me.

    You should find this post useful: http://flexponential.com/2010/12/05/saving-scroll-position-between-views-in-a-mobile-flex- application/
    It demonstrates one way of saving and restoring data when pushing and popping a view.

  • Contextual event - handler called before producer bean's setter

    I am trying a simple contextual events usecase:
    Page A.jsff has an input text field whose value is directly stored in a bean variable (bean is in pageFlowScope). Contextual event is defined on value change event for this input field. A.jsff has taskflow B_btf as an embedded region.This B_btf will simply display the value entered in the A.jsff. So, when contextual event is raised, the handler sets the value in a local variable of B_btf bean. The problem is that the handler method is getting called before the setter for the attribute of the bean of A.jsff. This is resulting in the B_btf displaying the last-but-one value entered in the input field of A.jsff instead of the current/latest value. Any tips?
    Thanks,
    Amitabh

    The issue was with the (lack of) understanding of the JSF lifecycle. The value change listener is called during the Process Validation phase, whereas the managed bean (Model) values will be set in the Update Model phase which lies next-in-line after Process Validation phase. Hence, if the value change listener is to be used, then the handler code should have used the default payload and not the custom payload. For a value change event the default payLoad will be a DCBindingContainerValueChangeEvent, and one can invoke getNewValue() to get the value entered in the text field (For details watch Frank Nimphius' video here: ADF Region Interaction - Contextual Events - YouTube). For my case, I added a command button to the page, and moved the contextual event to that button.

Maybe you are looking for