Wolfram Language

Cloud & Web Interfaces

Create a Webpage That Computes the Total Mass of Multiple Chemicals

Create a FormFunction that has two columns of rows: one for a chemical and another for the amount in moles. To do that, you can use RepeatingElement and CompoundElement.

In[1]:=
Click for copyable input
CloudDeploy[ FormFunction[ {"items", None} -> RepeatingElement[ CompoundElement[<| "chemical" -> <| "Label" -> "Chemical", "Interpreter" -> "Chemical" |>, "mol" -> <| "Label" -> "Molar amount", "Interpreter" -> QuantityVariable["Amount"] |> |>]], EntityGroup[EntityInstance @@@ #items]["AbsoluteMass"] & ] ]
Out[1]=

Visit the form.

You can add as many rows as you want, and the form will calculate the total mass.

This form will also look good on a mobile device, where screen real estate is scarce, thanks to its responsive design.

Related Examples

de es fr ja ko pt-br ru zh