Expand my Community achievements bar.

SOLVED

Java Script for Add/ Remove Button

Avatar

Level 2

Can anyone help me out? I'm a newbie and have no idea of Java Script  or Form Calc language. Please guide or help me to write the language for 2 buttons Add and remove....Please!

Edigo

1 Accepted Solution

Avatar

Correct answer by
Level 2

Edigo,

I've attached a PDF that adds JavaScript to your buttons. I'm unable to verify that this form works with LiveCycle 7.2 because I'm on a later version. But it demonstrates how to use the instance manager to add and remove table rows.

Here are the other changes I made to your form:

  • Changed the rows to be different instances of the same row. That change lets us use the instance manager to access the rows like entries in an array.
  • In the Binding dialog, changed the second rows to have a Min Count of 0.
  • Changed the subform to Float rather than fixed. That way the Add/Delete buttons don't overlap with the table.
  • Wrapped the Add/Delete buttons in a subform.
  • Added a title subform.

From a usability point of view, the form has some problems. To delete the second row in the table, you have to delete the third through nth rows. I suggest you add a "Delete" button in each table row. That would let users delete a specific row rather than just the last one. The Designer 8.2 documentation contains an example that explains how. See http://livedocs.adobe.com/livecycle/8.2/wb_designer/wwhelp/wwhimpl/js/html/wwhelp.htm.

The Designer help is here

http://livedocs.adobe.com/livecycle/8.2/wb_designer/wwhelp/wwhimpl/js/html/wwhelp.htm

Good luck.

Kathy

View solution in original post

5 Replies

Avatar

Correct answer by
Level 2

Edigo,

I've attached a PDF that adds JavaScript to your buttons. I'm unable to verify that this form works with LiveCycle 7.2 because I'm on a later version. But it demonstrates how to use the instance manager to add and remove table rows.

Here are the other changes I made to your form:

  • Changed the rows to be different instances of the same row. That change lets us use the instance manager to access the rows like entries in an array.
  • In the Binding dialog, changed the second rows to have a Min Count of 0.
  • Changed the subform to Float rather than fixed. That way the Add/Delete buttons don't overlap with the table.
  • Wrapped the Add/Delete buttons in a subform.
  • Added a title subform.

From a usability point of view, the form has some problems. To delete the second row in the table, you have to delete the third through nth rows. I suggest you add a "Delete" button in each table row. That would let users delete a specific row rather than just the last one. The Designer 8.2 documentation contains an example that explains how. See http://livedocs.adobe.com/livecycle/8.2/wb_designer/wwhelp/wwhimpl/js/html/wwhelp.htm.

The Designer help is here

http://livedocs.adobe.com/livecycle/8.2/wb_designer/wwhelp/wwhimpl/js/html/wwhelp.htm

Good luck.

Kathy

Avatar

Level 2

Hi Kathy,

Thanks a million for your help.I really appreciate it.

By the way, I clicked at the link you said about adding delete button in each table row, it actually leads me to Designer Help. If you have time, can you recheck it?

Edigo

Avatar

Level 1

If I add an item in innerHTML, it does not work with IE Is there a solution for this?

Resveratrol

Resveratrol
Anti Aging Supplement

Avatar

Level 2

Oops. Those URLs weren't very helpful. Here are more specific paths.

Using LiveCycle Designer ES > Working with Form Designs > Working with forms that have a flowable layout > Creating interactive forms that have a flowable layout > To add and remove tables and table rows by using scripting

BTW, the content at the above path erroneously shows the removeInstance parameter as "true". It is actually an integer.

Table1.Row1.instanceManager.removeInstance(true);

Using LiveCycle Designer ES > Working with Form Designs > Using tables > Creating tables that grow > To create a table that grows using the Button object

Make sure you click on the two topics in this discussion to get specific instructions.

Kathy

Avatar

Level 2

To Resveratrol,

I'm not familiar with the innerHTML object. But searching for LiveCycle and innerHTML yields some interesting results. In particular, this article looks fruitful:

http://www.adobe.com/devnet/livecycle/articles/smartdoc_dotnet.html

You may also wish to start a separate Adobe Forum discussion on this issue. Make sure you place your query in the forum for your version of LiveCycle. This forum is for older versions.

Kathy