1
$\begingroup$

I've this form:

f[a_, b_] := a + b;
form = FormFunction[FormObject[<|"a" -> "Number", "b" -> "Number"|>], f[#a, #b] &];
form[]

How I can automatically bring up the form after the output display? (If I insert 3 and 2 and I click submit, it return 5. After 5, I'd like to see the form again.) And can I remove "Cancel" or assign it an action like "Submit" button? Thanks

$\endgroup$
1
  • 2
    $\begingroup$ Broadly, what are you trying to accomplish? Is it necessary that FormFunction be used? $\endgroup$
    – bbgodfrey
    Jun 26, 2016 at 4:38

2 Answers 2

1
$\begingroup$

The form[] can be returned as the output.

f[a_, b_] := a + b;

form = FormFunction[
   FormObject[<|"a" -> "Number", "b" -> "Number"|>], (Print@f[#a, #b]; form[]) &];

form[]

enter image description here

$\endgroup$
0
$\begingroup$

I solved with

f[a_, b_] := a + b;
FormPage[{"a" -> "Number", "b" -> "Number"}, f[#a, #b] &]

The result is show below the form.

$\endgroup$
1
  • $\begingroup$ I've an other problem with this type of form but with an other example. I've a function f with different Print. The output is show below the form but Print's output are shown in an other window (a notebook called "Message"). How can I disable this notebook to show its contents directly below the result of the function? $\endgroup$
    – RossFe
    Jun 26, 2016 at 13:06

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.