Message Boards Message Boards

CloudDeploy Example: Custom FromFunction Design for Gas Pressure

Posted 8 years ago
Attachments:
POSTED BY: Scot Martin
5 Replies
Posted 8 years ago

Hello @Scot Martin and @Carlo Barbieri, the link that Scot gave us in his post (https://www.wolframcloud.com/objects/user-9a32cd4b-ac8e-41b8-a00d-a9bf698ed3b0/PressureDemo) works great in my Windows PC, however it does not work from my iPad or iPhone: I am able to change the numbers, however the calculation is Not performed after hitting Enter (the Enter key in the iPhone/iPad screen actually becomes labeled "ir", which is Spanish for "Go", I am in Mexico). I really really really want to use Wolfram Development Platform to create interactive web pages to be used from mobile phones and tablets of any brand and operative system, will I be able to do it? do you know why this example (and others, even simple ones) do not work properly from my iPad and iPhone? Does this happen with any mobile device? Thank you

POSTED BY: Jose Gomez

Hi,

First of all it's great to see our little function being put to such good use, I really like the form you've deployed!

I've noticed you use bare HTML tags in your form. Please note that the fact that doing that works at all right now is a serious bug and your form will probably break in the next week or two. The right way to use HTML in a form (or template) is by using EmbeddedHTML, which tells the templating engine not to escape the tags.

Another thing you might want to be aware of is the $Permissions global variable that you can set to "Public" directly. This way you won't have to pass options to CloudDeploy.

And lastly (but I'm sure you've already know about this) a style suggestion.

CompoundExpression[
    a,
    b
]

is exactly equivalent to

a;
b

which is, in my opinion, a bit more readable.

Thanks!

Carlo

POSTED BY: Carlo Barbieri
Posted 8 years ago

Carlo,

That is really an excellent (and important!) hint about EmbeddedHTML[ ]. Thank you for that. I'll put it to use right away so that my code becomes compliant with the expected upcoming updates that you mentioned.

I hope you could give a hint or solution on two other items that I have struggled with and that still stump me:

  1. For the following function, how can I stylize InputField[ ], e.g., to change the field color to yellow?

    inputField[deployVariable : _String, label : _String | _Style, 
      initialInput : _String | _Missing, 
      interpreter : _ : Restricted["Real", {0, Infinity}]] :=
    
     deployVariable ->
      <|
       "Label" -> label,
       (* 3. How to adjust the size of an input field [
       I picked up this hint on the forums] *)
       "Control" -> Function[InputField[##, FieldSize -> inputFieldSize]],
       "Input" -> initialInput,
       "Interpreter" -> interpreter (* declared default if omitted: 
       Restricted["Real",{0,Infinity}] *)
       |>
    

1a. I tested the normal options listed in Options[InputField], such as Rule[Background,Yellow], but these options do not appear to work (i.e., the color is still white) after CloudDeploy[]. In fact, of all the Options[InputField], the only option tested by me that appears to work is FieldSize.

1b. Related to this question, an actual call to the foregoing function returns something like the following on the Wolfram Cloud (i.e., via view source):

<input type="text" value="293.15" size="25" class="form-control" name="temperature" id="id_temperature" data-field-name="Real" data-field-type="Structured" data-field-verbose="real number"/>

Question - How can I pass through some styling in the Wolfram framework of the options and their specifications so that I would get a return like the following in the produced HTML on the cloud. That is, how can I pass through verbatim ' style="background-color: yellow;" ' to get included within <input>?

 <input type="text" style="background-color: yellow;" value="293.15" size="25" class="form-control" name="temperature" id="id_temperature" data-field-name="Real" data-field-type="Structured" data-field-verbose="real number"/>

.2. More generally, how can I associate my own CSS style sheet with the return from FormFunction[ ] ?

Thank you! I am looking forward to your hints and solutions!

Scot

POSTED BY: Scot Martin

enter image description here - you have earned "Featured Contributor" badge, congratulations !

This is a great post and it has been selected for the curated Staff Picks group. Your profile is now distinguished by a "Featured Contributor" badge and displayed on the "Featured Contributor" board.

POSTED BY: Moderation Team

Thanks Scot...this is very useful!

POSTED BY: Aeyoss Antelope
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