This discussion is archived
3 Replies Latest reply: Dec 10, 2012 5:36 AM by VC RSS

save tabular form before AddRow()

978639 Newbie
Currently Being Moderated
Hello all,

I am trying to have a simple solution to save tabular form before Adding a new Row.
so I asssigned 2 dynamic actions to the AddRow button to submit and run
javascript:addRow();

I have made sure the sequence numbers are correct to submit first. But what it ended up with looks like addrow() got run first.

So I then adited to run the below scripts on a dynamic action, but it is still not right.
javascript:doSubmit();
javascript:addRow();


Have I missed something?

Many thanks

Edited by: 975636 on Dec 7, 2012 4:49 PM
  • 1. Re: save tabular form before AddRow()
    VC Guru
    Currently Being Moderated
    975636 wrote:
    Hello all,

    I am trying to have a simple solution to save tabular form before Adding a new Row.
    Why??
    so I asssigned 2 dynamic actions to the AddRow button to submit and run
    javascript:addRow();

    I have made sure the sequence numbers are correct to submit first. But what it ended up with looks like addrow() got run first.

    So I then adited to run the below scripts on a dynamic action, but it is still not right.
    javascript:doSubmit();
    javascript:addRow();
    You have to understand two things here:
    javascript:doSubmit() - submits the page, when a page is submitted the page will be redirected to the target branch OR renders the same page if there is no branch.
    javascript:addRow() - this only adds the empty row on the fly on the client side/browser.
    So this will not work because once the page is rendered again after doSubmit().
  • 2. Re: save tabular form before AddRow()
    978982 Newbie
    Currently Being Moderated
    Thanks for the inputs, VC.

    It is because the content in the newly inserted rows need to be saved regularly.
    The users would often work on many rows for data input. The problem we have is that Popup LOVs are not saved untill you click on save/submit/appy changes button.

    If the user encounters any error which makes the tabular form reload, then they lose the large amount of data they just put/changed.
    So the idea was to force a saving when they add a new row.


    Is there anything we could do before javascript:addRow() to save the data on display?

    Many thanks
    Best
    Yang
  • 3. Re: save tabular form before AddRow()
    VC Guru
    Currently Being Moderated
    Just an idea -
    What you can do is that add a dynamic action that adds a blank row on every page load

    Event: Page Load
    True Action: Execute JavaScript Code
    //add this code
    addRow();
    And edit the Add Row button and change the Target URL so that it submits the page when clicked
    javascript:apex.submit('SUBMIT');

Legend

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