Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Binded based on dropdown values in a flowable table

Avatar

Former Community Member

Can someone please help me with my practice form?  I am just started learning to make a fillable pdf form. I made my practice form patterned after the Purchase Order Form sample that came with livecyle installation.  I want my table to automatically display the unit price when I select an item from the dropdown list.  I managed to do that by using below script.  The problem comes in when I am adding rows my selection keeps on reverting back to the first item on the dropdown list or on my first selection on the first row. Should I add something on below script.  Please help.

menu.JPG

RefreshmentOrderform.RefreshmentOrder.details.detail[0].item::change - (JavaScript, client)

unitprice.rawValue = this.boundItem(xfa.event.newText);

unitprice.value = xfa.event.newText;

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

The problem you are having is because the id values of the drop down are duplicated, if I choose cherry slice I get an id of 3 (which is meant to mean $3.00) but this is also the id of Ambassador (as well as Brownies and Coffee).  So similar problem with Chocolate Tarts going to Assorted Mini Cookies.

So you need to keep the id unique.  At first I thought you should set the id to 1,2,3,4,.. and have a table lookup for the price, but I liked your idea of keeping it all in the drop down control, so if you changed the make them unique, something like 1:3.00, 2:1.50, 3:3.00, ... you could strip of the part before the colon by changing your change event code to;

unitprice.rawValue = this.boundItem(xfa.event.newText).split(":")[1];

Which turns the id into an array and takes the second element.

Also, there are some run time errors in your form.  In Acrobat (or Reader) you should turn on "Show console on errors and messages", which is under Preferences ... JavaScript.

The second line in your change event causes a runtime error as the value property of a numeric field is its default value and to correctly reference it you need to use;

 

unitprice.value.oneOfChild.value

But you don't need that line at all in this case.

There is also a problem with the initialise script in numServiceChargerate, which looks like it is a problem moving from FormCalc in some parts of the form to JavaScript in others, I would try and stick with one or the other.

Good luck

Bruce

View solution in original post

7 Replies

Avatar

Employee

Omeng,

I'm moving your discussion to the Acrobat forms forum, since this is not related to the CreatePDF service.

Dave

Avatar

Level 4

Actually, it should be transferred to the LiveCycle Designer forum, since

this form was not created in Acrobat.

Avatar

Employee

Thanks, Try.

Moving to Designer.

Dave

Avatar

Level 10

Hi,

This could be a problem with your binding (check the binding tab of the object pallete) in that each field in all the rows are bound to the same element or you could have a default value set, or ... Maybe if you can host your form somewhere like Acrobat.com and post the link here we can get a better idea.

Good luck

Bruce

Avatar

Former Community Member

Hi,

Hope I uploaded the file right. Below is the link to the form I made.

http://forums.adobe.com/docs/DOC-2041

Avatar

Correct answer by
Level 10

Hi,

The problem you are having is because the id values of the drop down are duplicated, if I choose cherry slice I get an id of 3 (which is meant to mean $3.00) but this is also the id of Ambassador (as well as Brownies and Coffee).  So similar problem with Chocolate Tarts going to Assorted Mini Cookies.

So you need to keep the id unique.  At first I thought you should set the id to 1,2,3,4,.. and have a table lookup for the price, but I liked your idea of keeping it all in the drop down control, so if you changed the make them unique, something like 1:3.00, 2:1.50, 3:3.00, ... you could strip of the part before the colon by changing your change event code to;

unitprice.rawValue = this.boundItem(xfa.event.newText).split(":")[1];

Which turns the id into an array and takes the second element.

Also, there are some run time errors in your form.  In Acrobat (or Reader) you should turn on "Show console on errors and messages", which is under Preferences ... JavaScript.

The second line in your change event causes a runtime error as the value property of a numeric field is its default value and to correctly reference it you need to use;

 

unitprice.value.oneOfChild.value

But you don't need that line at all in this case.

There is also a problem with the initialise script in numServiceChargerate, which looks like it is a problem moving from FormCalc in some parts of the form to JavaScript in others, I would try and stick with one or the other.

Good luck

Bruce

Avatar

Former Community Member

Bruce,

Thank you so much.. the colon thing work perfectly well.. I wanted the price to be binded on dropdown so it would be easy to change in case there are changes in prices instead of going over the whole script, I don't worry much with the runtime error as long as the form works.. thanks again!