0
$\begingroup$

I am trying to run a little program on the cloud where users have to supply some input - numbers. I wrote

enter code here formShort = FormFunction[ FormObject[{{"LSize", "Indicate the size of the forest in ha."} -> "Number", {"BurntHa", "Indicate the average number of ha. burnt per year"} -> "Number" }]]enter code here

After executing formShort locally (cloud deploy comes later) and fill the form for example with 2 and 3 I get something that looks like an association but I cannot assess the values and therefore I have no values for the program. What is missing in the code or is
FormFunction not the right approach. Thanks a lot Renan

$\endgroup$
1
  • $\begingroup$ Please clarify your question. There are several issues: (1) You're missing a quote mark, (2) formShort is not provided, (3) if I run this, FormFunction[FormObject[{{"LSize", "Indicate the size of the forest in ha."} -> "Number", {"BurntHa", "Indicate the average number of ha.burnt per year"} -> "Number" }]][], I get a valid form, and if I fill it out and submit it, I get a valid association. $\endgroup$
    – lericr
    Oct 13, 2022 at 21:49

1 Answer 1

2
$\begingroup$

FormFunction accepts a function and it has access to the values entered. E.g.

FormFunction[
 FormObject[{{"LSize", "Indicate the size of the forest in ha."} -> 
    "Number", {"BurntHa", 
     "Indicate the average number of ha.burnt per year"} -> 
    "Number" }], #BurntHa/#LSize &]
$\endgroup$
2
  • $\begingroup$ After running this code and ask `` ?LSize `` I get that the variable is a global value but no value is assigned $\endgroup$
    – RUG
    Oct 14, 2022 at 7:50
  • $\begingroup$ The value will not be assigned unless it is explicitly done in the function. E.g. LSize = #LSize&. But there is no reason to do that and pollute the global namespace, the function should perform whatever computation is required using the values and return the desired result for display in the form. $\endgroup$ Oct 17, 2022 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.