The JavaScript for/of statement loops through the values of an iterable objects for/of lets you loop over data structures that are iterable such as Arrays, Strings, Maps, NodeLists, and more. The for/of loop has the following syntax: for (variable of iterable). I'm creating an ordering form for a photograph printing business with Adobe Acrobat 10. The concept is that the user will input data for each photograph individually - file name, paper size and paper type into cells in a table and a fourth column will calculate the price. Sep 09, 2011 Hi all, I'm a beginner to LiveCycle and I cant seem to get a loop working within a function. The function is being called successfully because when I.
I'm creating an ordering form for a photograph printing business with Adobe Acrobat 10. The concept is that the user will input data for each photograph individually - file name, paper size and paper type into cells in a table and a fourth column will calculate the price.
The paper size and paper type are drop down menus, Paper Size with 4 Options and Paper Type having 3 Options, so 12 combinations all with different prices.
I want a cell in the fourth column of each row to calculate the price based on the options the user has selected, but cannot reach this using addition/multiplication etc.
I have the concept that i need to write an IF statement with multiple conditions as in Excel but am not familiar with JavaScript and so need some help!
Thank you in advance!
2 Answers
I'm not familiar with the excel format myself, but in javascript you might have something like this :
Of course there are many ways of dealing with this problem, from nesting the if statements to storing everything in a map/hash/object to using switch statements. Comparison naturally doesn't need to be against numbers, you could also use strings.
David McMullinDavid McMullinMake it an object and use it as a lookup-table to prevent too many if-else-statements:
If the user could enter invalid input, you can check for existance of the key with if (size in priceByPapersizeAndPapertype)
and put an error message if needed.