Expand my Community achievements bar.

SOLVED

Creating a button to add and remove a section

Avatar

Level 2

Hi Everyone,

I have been asked to create a form using Design ES that has element that will  only get added by the click of a button. To learn this I created a simple  document. Two objects a button to control the object that will get added and the  object.

Here is how my file is structured.(if I get some terminology wrong please  feel free to correct me)

On my form I have the main subform called "main" then as a child subform of  the "main subform called "dyn". I then have the button as an object on the main  subform and I have the object (a drop down list) to get added on the "dyn"  subform.

What I did so far is put focus on the button and in the scripting window I  selected "click" from the "Show" drop down and selected JavaScript for the  "Language" drop down. I then added the following syntax.

// Invoke the Instance Manager to add one instance of the dyn  subform.


main._dyn.addInstance(1);

I saved my work at this point and went to Preview PDF. When I click the  button nothing happens.

Any help on this would be appreciated. I have attached my PDF if it  helps.

Thanks

Greg

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

On the detail subform you did not allow more than one subform. Click on the detail subform and on the binding tab click the checkbox that says "Repeat Row for Each Data Item".

Are you using Preview to view your form? If so it is setup to create a Print form and your buttons will be disabled. On the Preview Tab in Form Properties set the Preview Type to Interactive.

Paul

View solution in original post

8 Replies

Avatar

Former Community Member

Hi Greg,

Unfortunately your form is queued (a.k.a. caught in the virus scanner) so I can't take a look. What you are witnessing in your form is commonly a result of failing to save the form as a dynamic PDF (at least it is common to me). If the form is not defined and saved as a dynamic PDF, the instance manager or other methods of show/hiding objects will not work.

Which leads me to this...I am not exactly sure of your requirements, but if you simply need to show/hide a dropdown list, using a subform and the instance manager may be overkill. You can change the presence property of the dropdown to make it visible or invisible. The attached sample performs as follows:

show-dropdown.PNG

When you click the button labelled 'Show Dropdown'....

hide-dropdown.PNG

the dropdown appears and the caption on the button changes to 'Hide Dropdown'. You get a toggle effect.

Steve

Avatar

Former Community Member

Now that your form is not queued I had a look and Steve was right (you did not make it a dynamic form). This was th e1st problem. Then bu the way you designed it you did not allow more than one instance of the dyn subform. The setting cannot be accessed unless the container subform (in your case - main - is flowed). Once you change it to flowed then you can set the Repeat Subform for each Data Item on the Binding tab. This tells the form that you may have multiple instances.

Paul

Avatar

Level 2

Thanks guys!

One question, how do you make your Form dynamic?

Just so you are aware the form I will be eventually creating will be much  more complicated than my one I have provided here. I am just trying a very basic  example to understand the process.

Avatar

Former Community Member

File/SaveAs and choose the dynamic PDF option.

Paul

Avatar

Level 2

Thanks after playing with my original document I wasn't sure what the problem  was so I tried to replicate the PurchaseOrder from in the sample files.  Obviously I missed some steps as indicated in your previous posts so I worked  with this new file to try and solve my problems.

Here is my new file with the corrections of making it a 1. Dynamic form and  making the Subform flowed and selecting the check box "Repeat subform for each  data item"

Still doesn't work and I am not sure why.

Avatar

Correct answer by
Former Community Member

On the detail subform you did not allow more than one subform. Click on the detail subform and on the binding tab click the checkbox that says "Repeat Row for Each Data Item".

Are you using Preview to view your form? If so it is setup to create a Print form and your buttons will be disabled. On the Preview Tab in Form Properties set the Preview Type to Interactive.

Paul

Avatar

Level 2

Thank you very much!! That did it.

One question though does dynamic elements have to be in a table? The reason I ask is I tried another Form that only had one button and one object that wasn't in a table and I couldn't get it to work.

Avatar

Former Community Member

No it doesn't have to be in a Table. The table gives you a structure of a flowed container with positioned subforms inside. It is the flowed container that allows the creation of objects. You can create a similar structure on your own by grabbing associated objects and wrapping them in a subform (and setting the type of course).

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----