Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Dynamic Table

kunal
Level 2
Level 2

I want to add a row in a table based upon Number given in a textfield, eg- if 5 is given 5 rows must be added,again if some other no. is given then that many rows only should be present + if no. is greater than the previous then those rows should be retained so that user dont have to write again , please suggest something. i have kept the row in a subform and i am able to get the result for 1st time but when changing the value desired reult is not obtained

for (var i = val; i>1 ;i--)

   {

     _test.removeInstance(i-1);

   }

this is the simple code used,i am not able to use it with right condition i guess.

1 Accepted Solution
kvdvijaykumar
Correct answer by
Level 4
Level 4

Hi Kunal,

Pls try doing the following:

1) Reomove all the script on the exit event of "NumArticle"

2) Don't set max count.

3) Set only min count = 1

4) Add the following script on the exit event of "NumArticle"

Form1_Dtls.MainPage.EntrenchmentDetails.instanceManager.count = this.rawValue;

[Don't add any other script other than the above line]

Pls give a try and let me know.

Thanks,

VJ

View solution in original post

0 Replies
kvdvijaykumar
Level 4
Level 4

Hi Kunal,

You can use the following script on the exit event of the numeric field:

 

form.Page1.Table1.Row1.instanceManager.count = this.rawValue;

Where, Row1 is your repeating row.

Let me know if this works.

Thanks,

VJ

kunal
Level 2
Level 2

thanks,its working,but i am getting 1 row extra,subform+instances,but i only want instances,then what to do ?

kunal
Level 2
Level 2

i can not,because of company policies

kvdvijaykumar
Level 4
Level 4

Is it not possible to send a sample form - A form in which only the repeating subform copied and confidential data masked?

btw, did u select min count = 1 ?

Thanks,

VJ

kunal
Level 2
Level 2

yes i kept the min and max count,the only prob is one extra row is coming,

----- Form1_Dtls.MainPage.NumArticles.NumArticle::exit - (JavaScript, client) ----------------------

if(this.rawValue != null)
{
  var val = this.rawValue;

if ( val > 91)  val = 91;
  for(var i=1; i<val ; i++)
  {
  
  Form1_Dtls.MainPage.EntrenchmentDetails.instanceManager.count = this.rawValue;

   _EntrenchmentDetails.addInstance(0);
   
}
}

this is the code i used,even i tried with i in addInstance,but dint work

kvdvijaykumar
Correct answer by
Level 4
Level 4

Hi Kunal,

Pls try doing the following:

1) Reomove all the script on the exit event of "NumArticle"

2) Don't set max count.

3) Set only min count = 1

4) Add the following script on the exit event of "NumArticle"

Form1_Dtls.MainPage.EntrenchmentDetails.instanceManager.count = this.rawValue;

[Don't add any other script other than the above line]

Pls give a try and let me know.

Thanks,

VJ

View solution in original post

kunal
Level 2
Level 2

thanks alot vijay it is working,u saved a lot of my time.

kvdvijaykumar
Level 4
Level 4

Hi Kunal,

No problem.

can u mark this answer as "Correct"? This would be helpful to others.

Thanks,

VJ

kunal
Level 2
Level 2

Hi VJ,

I am using this form with radio buttons,on yes this functionality works,but on NO,how to hide the instances ?

kvdvijaykumar
Level 4
Level 4

You can hide the entire section as:

Form1_Dtls.MainPage.EntrenchmentDetails.presence = "hidden";

Thanks,

VJ

kunal
Level 2
Level 2

with this only main subform is hiding,instances are not going,i already applied this

kvdvijaykumar
Level 4
Level 4

If your repeating instances are a part of your main subform, then the instances should also hide.

Make sure that your instances are inside you main subform and not outside or at same level of the main subform.

--- The following is correct -----

<subform>

     <repeatingsubform>

</subform>

--- The following is wrong -----

<subform></subform>

</repeatingsubform> </repeatingsubform>

I could check if you can share me the sample template.

Thanks,

VJ

kunal
Level 2
Level 2

<subform>

     <repeatingsubform>

</subform>

i am following this hierarchy throughout the form

but for this i am giving radiobutton condition in one subform,textfield condition in another,and then repeating is 3rd,shall i keep these 3 subforms again in a single subform ?