Message Boards Message Boards

Use StandardForm in Cloud FormFunctions?

Posted 7 years ago

Cross posted on Mathematica.stackexchange

Example

choices = {
   "label 1"                     -> 1
  , Column[{"label", 2}]         -> 2
  , Framed[3]                    -> 3
  , HoldForm @ Sum[i, {i, 0, ?}] -> 4
};

CloudDeploy @ FormFunction[
 { "a" -> <|
     "Interpreter" -> choices
   , "Control" -> (RadioButtonBar[##, Appearance -> "Vertical"] &)|>
 }
]

enter image description here

So by default StandardForm is not supported (though e.g. Column is).

My attempts to fix it

I tried to force "HTMLCloudCDF" as an export form for those elements:

...
"Interpreter" -> MapAt[ExportForm[#, "HTMLCloudCDF"] &, choices, {All, 1}]
...

enter image description here

But it is not supported.

At the end I am using: ExportForm[#, "SVG"] & but it makes fonts inconsistent with the rest of the form and selected item's label gets an ugly red frame if it is an image:

enter image description here

Question

How to use arbitrary expressions in form functions layout? Is there a better way than SVG? Shouldn't it work out of the box?

Related

https://mathematica.stackexchange.com/q/123894/5478

POSTED BY: Kuba Podkalicki

Apparently Underoverscript doesn't have a web implementation, but Subsuperscript does.

choices = {"label 1" -> 1, Column[{"label", 2}] -> 2, Framed[3] -> 3, 
   Row[{Subsuperscript["&sum;", "i=0", "?"], "i"}] -> 4};
CloudDeploy@
 FormFunction[{"a" -> <|"Interpreter" -> choices, 
     "Control" -> (RadioButtonBar[##, Appearance -> "Vertical"] &)|>}

https://www.wolframcloud.com/obj/52801029-e6f8-45c5-925b-db69c86aabcb

Styling might improve the "i=0" subscript, but this does not look as polished as your SVG so my guess would be that SVG is the better option.

You might also check out

https://mathematica.stackexchange.com/questions/167333/encoding-strings-to-workaround-clouddeployment-bugs

POSTED BY: John Vande Vate
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract