Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How do I create an "Add Row" button (add instance with click activity)

Avatar

Level 2

I've been looking through a couple of examples, but the xml is lost on me. I need to learn how to do this for myself because it'd help me out on so many forms. There're forms I just simply cannot do without this function.

Where I get lost is the javascript linking the button to the specific table. I've been trying to use this I found in an example:

<event activity="click">

<

script contentType="application/x-javascript">SAPS350a.Page1.TableData1.Table1.Row2.instanceManager.addInstance(1);</script>

</

event>

Now, I'm a complete newbie, so I'm sure someone can point out to me exactly what's wrong, but I dont know what "SAPS350a" means nor can I figure out where the label "TableData1" connects to.

If anyone can explain this in a "add rows for dummies" fashion, I'd be greatly appreciative.

See attached an example of one of the fields I need to repeat.

4 Replies

Avatar

Former Community Member

Hi Liz. You shouldn't really be playing in the xml. Especially if you are a newbie . You could corrupt the whole form if you do something wrong and you probably wont be able to rectify it. Scripts must be added in the script window. In your post, the 'SAPS350a.Page1...' is the path to the row of the particular form that you copied that code from. I have added a button to your form. have a look at the script to see what i have done.

Avatar

Level 2

Thanks, I can't seem to duplicate your sucess. I ended up just copy and pasting the whole section, but it doesn't seem to work. I'll go ahead and show you the whole form here with the content you posted included.

Avatar

Former Community Member

My call uses a page1 node .....you can simply rename the untitled page to page1 and it will all work. Here is an updated version.

paul

Avatar

Level 2

Thanks, it's working now!

I actually found 2 solutions, someone else showed me

StateInformation._Detail.addInstance(1);

And that worked as well. Thanks all!