# Wolfram Cloud deployment obstacles

What are official restrictions about FormFunctions/general deployment contents?

There are problems with many things which sometimes I have workarounds for but I see no general pattern.

Edit: I moved examples to the answer to keep a clean index here.

## Fixed problems:

(may be relevant for users with old MMA / EPC)

## Pending review:

Additionally, are there any general rules to follow?

• One approach might be to search in the FormFunction webpage JavaScript for the "Select a valid choice" string. If it's present then Beautify and return here with a JavaScript question. Even if this string originates on the server side, looking at the client side JavaScript may give useful information. – Christopher Haydock Aug 14 '16 at 17:02
• @ChristopherHaydock You are probably right but as you noticed it may be a waste of time, or the insight/solution got this way may be out of date very soon since cloud is updated asynchronously to Mathematica and silently. I was hoping that maybe I've missed something from documentation or maybe I could get "how to think about deploying" answer. – Kuba Aug 15 '16 at 5:32

## 2 Answers

• I narrowed down the code to displaying "\!$$\*SuperscriptBox[\(x$$, 2]\)" or simpler "\!2" and then run it in Mathematica, Wolfram Cloud (Using CloudDeploy), Wolfram Development Platform(Which I strongly suspect as a simple expansion of Wolfram Dev. or so) and here and found out that NONE of the online platform can display this code properly.

I asked a question here and the moderator on the site informed me that this is a CONFIRMED bug in WSTP.

The official reply is:

Yes I can confirm this is an improper behavior of the function LinkRead. Our developers are already aware of this issue and they are putting effort in fixing it. Hopefully this will be fixed in next release.

(and the moderator added: OMG, the next update, god knows when! and now there's v11 and this problem is still unfixed :P)

The main reason suspected is:

Kernel will fell into dead loops after encountering these expressions when using WSTP

So it seems that we can only aviod to use these expressions.

# More things to Aviod

There're (at least) one thing we should aviod:

1. DO NOT add anything other than [blahblah] after \

I will update this post when necessary.

• Special characters break validation

CloudDeploy @ FormFunction["x" -> {"P(\[EmptySet]) \[Equal] 0"}, f]


As we can see the choice is displayed correctly but the form validation is broken due to the encoding.

Even if one uses "x" -> {"P(\[EmptySet]) \[Equal] 0" -> 2} labeled spec for alternatives, 2 is passed further as an answer, the same error appears...

ToString[#, CharacterEncoding -> "ASCII"]& is also only a partial fix since "\[EmptySet]" doesn't look appealing.

• Grid settings are not respected for anything but CloudCDF form.

How to set Grids/tables parameters? For example, spacings are ignored:

Grid[
Partition[CharacterRange["a", "z"], 4],
Spacings -> {5, 5}
] // CloudDeploy


This one is great:

 Column[  CharacterRange["a", "z"]  ] // CloudDeploy


While they are ignored, sometimes one can use html based styling to enhance them:

Grid[
Map[
StringTemplate[
"<div style='margin:15px; color:blue; border:2px dashed red; padding:15px;'></div>"
],
Partition[CharacterRange["a", "z"], 4],
{2}
],
Spacings -> {5, 5}
] // CloudDeploy


• : Reserved HTML characters (e.g. <) are not escaped properly (CASE:4025512)

 CloudDeploy[ FormFunction["x" -> AnySubset[{"a<b<c"}]]] (*lbl cut after a*)

• It's said that wolfram cloud now use HTML instead of Flash, so converting everything into HTML should be a solution! – Wjx Aug 16 '16 at 14:20
• @Wjx the problem is that you may want to have there something more than strings, how to wrap with "<div>" then? We would have to have a function which they use to convert expressions to html/js, but we don't. "HTMLElement" for ExportString doesn't seem to be it. – Kuba Aug 16 '16 at 15:09