This discussion is archived
2 Replies Latest reply: Oct 4, 2012 3:35 AM by ryansun RSS

Using the Form javascript.addrow() to pass values while creating a new row?

ryansun Newbie
Currently Being Moderated
Version: 4.1.0
DB: 11g
Theme- scarlet 21

Hi,

I have a standard tabular form with the add, delete, submit buttons. Now when we hit the Add button, it creates a new row in the form. I had a requirement such that the user selects a row using the standard checkbox and then when he hits add, it should create a new row, and also, copy the contents of the selected row to the new row.

Is this possible? Any suggestions please? I am thinking that I need to create a pl/sql process under Add button to check if the checkbox is selected, and if yes, then maybe run the javascript addrow(not sure if it can be done) and then try to populate the values.

Thanks!
Sun

Edited by: ryansun on Oct 4, 2012 12:34 AM

Edited by: ryansun on Oct 4, 2012 12:46 AM

Edited by: ryansun on Oct 4, 2012 12:46 AM
  • 1. Re: Using the Form javascript.addrow() to pass values while creating a new row?
    Joni Vandenberghe Pro
    Currently Being Moderated
    Yes this is possible, but not by using build-in Apex, you can do this using jQuery. I can't write the code here withouth seeing your page but in short:
    - Replace the function addRow on your add button to a function created by you
    - At the start of that function write addRow();
    - write a jQuery selector in the function to get the selected checkbox
    - Now use traversing to get the values of all the item columns of that row
    - then write those values in your last row using selectors and traversing again

    Edited by: Joni Vandenberghe on 4-okt-2012 2:22
  • 2. Re: Using the Form javascript.addrow() to pass values while creating a new row?
    ryansun Newbie
    Currently Being Moderated
    Hi Joni,

    Thanks. I am not familiar with JQuery, is there some link where such a logic is implemented? Atleast a basic one of adding a new row, and traversing and capturing the values? In forms we could do it using cursor but not sure how to do it in Apex.

    In my case the requirement is straightforward. If there is a table with three rows and have a standard form in APEX with the add, delete and submit buttons along with the radio checkbox in a tabular form,

    If I select a row and then hit the add button, a new row should be added and the values of the previous row should be passed.

    Would you be having a link to any such demo or documentation on how this is done, would be very helpful.

    Thanks!
    Sun

Legend

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