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.

Features / bugs

  1. : Special characters (e.g. \[EmptySet\]), in form values, break FormFunction validation.

  2. : Some special characters in form layout break the form completely:

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

  4. : String representation of boxes causes problems

  5. feature: StandardForm is not supported for FormFunctions

  6. feature: Styling options ignored unless CloudCDF ExportForm is used.

  7. feature: Unclear dependencies collecting by CloudDeploy with Manipulate

Fixed problems:

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

  1. : Form/APIFunction dependencies collection problems

Pending review:

Additionally, are there any general rules to follow?

  • $\begingroup$ 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. $\endgroup$ Commented Aug 14, 2016 at 17:02
  • $\begingroup$ @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. $\endgroup$
    – Kuba
    Commented Aug 15, 2016 at 5:32

2 Answers 2

  • Avoid string representation of boxes

    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]

    enter image description here

    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:

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

    enter image description here

    This one is great:

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

    enter image description here

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

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

    enter image description here

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

     CloudDeploy[ FormFunction["x" -> AnySubset[{"a<b<c"}]]] (*lbl cut after a*)
  • $\begingroup$ It's said that wolfram cloud now use HTML instead of Flash, so converting everything into HTML should be a solution! $\endgroup$
    – Wjx
    Commented Aug 16, 2016 at 14:20
  • 1
    $\begingroup$ @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. $\endgroup$
    – Kuba
    Commented Aug 16, 2016 at 15:09

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.