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.
unitprice.rawValue = this.boundItem(xfa.event.newText);
unitprice.value = xfa.event.newText;
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.
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(":");
Which turns the id into an array and takes the second element.
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.
But you don't need that line at all in this case.
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!