This topic is locked

Inline Add cell value

10/24/2013 11:48:44 AM
PHPRunner General questions
S
sgchan author

Hi, I am using Javascript to trigger multiple inline adds using a loop. How do you populate the individual cells with values?
For example consider the below pseudo code

Loop

Create new inline

Add value into column 1

Add value into column 2

Add value into column 3

Add value into column 4

End loop
How to I add value into specific columns?
Many thanks in advance.

Sergey Kornilov admin 10/24/2013

First option (less work) - use default values. Whatever you set as a default value of the field will appear in inline add field control.
Second option - use Javascript OnLoad event on the Add page. This event will be executed in Inline Add mode as well. This way you can setup a different default value for the same field belonging to different record.

S
sgchan author 10/25/2013

Thanks for the reply.
The Default Value will only work if the cell in each row has the same data. Unfortunately, we also have incremental data. The actual table looks like the below:
Name Year/Month Amount

ABC 2005/01 3000

ABC 2006/01 3000

ABC 2007/01 3000
So I can easily use Default Value for Amount and Name because they are fixed.
I am using the Javascript button event to loop the number of rows to create in Inline Add. Then I plan using JavaScript OnLoad to set the Year/Month. I have 2 questions

  1. How do I pass the loop number from the JavaScript button event into Onload Event?
  2. How do I access the Year/Month field from JavaScript OnLoad event?
    Many thanks in advance.

Sergey Kornilov admin 10/25/2013

You can keep the track of the current Year/Month value in one of PHP session variables and increase it there accordingly (Add page: BeforeProcess event). Then you can pass the current value of year/month to Javascript OnLoad event of the Add page using proxy object: http://xlinesoft.com/phprunner/docs/how_to_access_php_variables.htm