Thursday, May 16, 2013

New Row Delete for ADF Form (ADF Webinar Follow-Up)

There was a question on ADF Masterclass Webinar (Video: ADF Master Class and ADF Blog Q&A, Andrejus Baranovskis (Part I)) about removing new row from ADF Form. I have a blog post about removing new row from ADF table - Immediately Removing New Row Without Validation in ADF, but one of the Webinar participants was saying the same doesn't work for ADF Form layout component. I promised to double check this and post sample application.

Here you can download sample application - NewRowRemoveApp_v2.zip. So, the main trick is additionally to setting Immediate=true for Delete button, add ADF resetActionListener operation to the same Delete button:


Make sure Immediate=true is set for Delete button, along with ADF resetActionListener:


Add new row, force validation errors by trying to navigate to the next row:


Press Delete button to remove new row, validation errors will be ignored and row will be removed:


For ADF Form component is not enough to set Immediate=true property only, ADF resetActionListener must be added to force form refresh.

10 comments:

  1. Hi Andrejus,

    It is not working, i am using jdev 11.1.1.6. I have created taskflow with two train stop and then i have created jspx page panel tabbed with two showDetailItem. In 1st i have train TF as region and in other showDetailItem i have other read only table.
    Whenever i click on 2nd showDetailItem, it is prompting with error messages. I have used the concept which u have shown in this post but his is not working. Could u plz help me

    Thanks
    Nitesh

    ReplyDelete
  2. So, sounds like you have different use case. Try setting skipValidation=true on all page defs.

    Another option is to wrap your form into af:subform component, it will ignore validations in other parts of the screen.

    Andrejus

    ReplyDelete
  3. Thanks :) .. i tried with skipValidation=true but not working and using af:subform i can able to navigate but validation messages are displaying in other showDetailItem.

    ReplyDelete
  4. This is bad :) Try to create sample app and send me, if I will have some free time, I will take a look.

    Hard to advice without checking your code, may be there is a bug somewhere :)

    ReplyDelete
  5. Thank u so much andrejus. :)
    Can u plz give ur mail id so that i can forward sample application.

    Thanks,
    Nitesh

    ReplyDelete
  6. hi andrejus,
    i have a doubt regarding removing a row with out validation will be done in adf means other technologies wil follow the validation??????????

    ReplyDelete
  7. Sorry, I dont understand the question.

    Andrejus

    ReplyDelete
  8. Hi,

    I encounter a problem in using CreateInsert and Delete function.

    I create a jsff page having a table and 2 buttons. The table is binded to a VO and the buttons are binded to CreateInsert and Delete operations. The VO has 2 fields. One primary key and a dummy field. The primary key is generated by the function adf.object.getSequenceNumber().

    Initially, the table/VO is empty.
    I go through the steps below.
    1. Click CreateInsert button.
    (a new row will be created, e.g. primary key = 1000)
    2. Update the dummy text to "abc"
    3. Click Delete button
    (the row is removed and the table is empty now)
    3. Click CreateInsert button again.
    (the row with primary key 1000 and dummy text "abc" appears again)

    I don't know why the last deleted row appears again. It happens ONLY when all the rows are deleted and the table is empty. If there is at least one row left, everything is normal.

    Thanks.

    Tony

    ReplyDelete