problem with default value
FormPage[{namespec -> type -> default, ...}, func ]
usesdefault
as the default for the field specified bynamespec
.CloudDeploy[#, Permissions -> "Public"] & @ FormPage[ "country" -> "Country" -> "CH" , GeoGraphics[#country] & ]
I see Berlin, certainly not Switzerland. But ok, one can say it is a default value, not the initial one. Sure, but Berlin map stays there if you submit an empty field.
FormFunction
documentation allows type to be a string, here"Country"
, but let's use association form:<|"Interpreter" -> "Country"
.Still Berlin.
Full syntax with an initial value seems to work fine:
fullFormPage = FormPage[ "country" -> <|"Interpreter" -> "Country", "Input" -> "CH"|> -> "CH" , GeoGraphics[#country] & ]
problem with typesetting
InputForm /@ { fullFormPage, ToExpression @ ToBoxes @ fullFormPage } // Column
FormPage[FormObject[<|"country" -> ...|>|>], GeoGraphics[#country] & ] FormPage[FormObject[<|"country" -> ...|>, <||>], GeoGraphics[#country] & ]
<||>
appeared inFormObject
, there is no error because it is a validOptionsPattern[]
, and I wouldn't mind but aFormPage
of this form misbehaves even for fully specified field:CloudDeploy[ ToExpression @ ToBoxes @ fullFormPage, Permissions -> "Public"]
Berlin again...
Am I misusing Form*
functions? Are those documentation's bugs or just bugs
CASE:3892750
p.s. related:
Problem with conversion of UI controllers' boxes to expressions
"Input"->"CH"
works, but it still doesn't work with the blank field. I agree that looks like a bug with handling the"Default"
parameter. $\endgroup$GeoGraphics["CH"]
. Which gives an error and my current location (yours must be Berlin). Try providing the full entity as the default value. And give"Input"->"CH"
as the input value for the users. $\endgroup$Interpreter
to the default value. Useful to know, but also a definite potential stumbling block. $\endgroup$