Wednesday, January 16, 2013

Create ADF Input Form Without First Displaying Existing Records

You can create a form that allows a user to enter information for a new record and then commit that record into the data source. While you can choose to use the default ADF Form and then drop the Create operation as a command button, when this type of form is first rendered, it displays the data for the first instance in the collection.

The ADF Creation form allows users to create new instances in the collection without first displaying existing instances, this scenario might be very simple but the new developers find difficulty in creating empty ADF Input Form when page loads for the first time.

You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11.1.2.2.0 + HR Schema]

Implementation Steps:-

Create Fusion web application with Business Components from Tables based on Department table. In view controller project create a jspx page then drag and drop DepartmentsView1->Form as ADF Form as shown in below image.


Go to page bindings, in Bindings section click on create control binding and select action item. In create action binding wizard select AppModuleDataControl->DepartmentsView1->Operation->createInsert.


In Executables section click in create executables Binding and select invokeAction item. In Insert invokeAction wizard and follow as shown in below image.


Edit the invokeCreateInsert and set the refresh to renderModel because when ever the page loaded this will execute the createInsert operation by inserting the empty record in the collection.


Run the jspx page and the web page will loaded with empty record.

17 comments:

  1. good job deepak...keep on posting......

    ReplyDelete
  2. It is a good article. I am very new to ADF and not able to finish your solution. I am using JDeveloper 11.1.1.6.0. In this did not find page bindings-->control bindings... Can you please elaborate on how to find page bindings. If you can, Please post screen shot of it. Thanks in advance.

    Regards,
    Raghu

    ReplyDelete
    Replies
    1. Hi,

      You can find the Bindings tab on the same page in down section otherwise right click on the page and select "Go to Page Definition" will leads to Page Data Binding Definition page.

      - Deepak

      Delete
    2. thanks for your information. Got it.

      Delete
  3. Can we do it for master-detail tables and also for the tables if we have multiple joins?

    ReplyDelete
    Replies
    1. Hi,

      In master-detail tables also you can achieve the above scenario.

      - Deepak

      Delete
  4. Hi Deepak,

    Thanks for sharing this article. In my form there are 2 fields and that are password and confirm password. Whenever these two matches, on click of commit it inserts the record in the data base(This is working fine). But if these two are not matches, it throws appropriate error and disabling the commit button. How can I enable commit button in the above error scenario.

    Regards,
    Raghu

    ReplyDelete
    Replies
    1. Hi Raghu,

      Sorry for the late reply.
      Remove Disabled attribute value #{!bindings.Commit.enabled} for commit button, this make commit button enabled always.

      -Deepak

      Delete
  5. Hi,
    I Tried the same steps, but on page load, I see the first record then on click of any other button e.g. navigation (first, last, prev) the form is rendered in create insert. Any tips on how to avoid that.

    ReplyDelete
    Replies
    1. Hi,

      In invokeAction Properties dialog window, set RefreshCondtion property as don't refresh if (first, last, prev) is clicked.

      -Deepak

      Delete
  6. Hi,
    Thank you for the post.

    I have a problem with displaying data that i entered in new form when i come back after navigation. The page is refreshing automatically. Is there a way to display data even after navigation?(which means navigating to next page and coming back)

    ReplyDelete
  7. Hi,
    Thank you for the post.

    am new in jdeveloper I would to know how to get invoke action properties in jdeveloper 12c

    ReplyDelete
  8. hey deepak..

    Your article copied fully by Santosh..

    see this

    http://adfnote.blogspot.de/2013/02/create-adf-input-form-without-first.html

    ReplyDelete
  9. right now i am working jdeveloper 12c . and using with java bean ... it is true . can i use to easy it..

    ReplyDelete
  10. @eric, I'm also in 12c and don't find invokeAction as a selection when I try to create executables binding. In the executables box are variables and 2 project iterators. When I click add, generic bindings, I get accessorIterator, iterator, methodIterator, page, searchRegion, and shuttleRegion.

    ReplyDelete