# FormPage oddities

1. problem with default value

FormPage[{namespec -> type -> default, ...}, func ] uses default as the default for the field specified by namespec.

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] &
]

2. problem with typesetting

InputForm /@ {
fullFormPage,
ToExpression @ ToBoxes @ fullFormPage
} // Column


FormPage[FormObject[<|"country" -> ...|>|>], GeoGraphics[#country] & ] FormPage[FormObject[<|"country" -> ...|>, <||>], GeoGraphics[#country] & ]

<||> appeared in FormObject, there is no error because it is a valid OptionsPattern[], and I wouldn't mind but a FormPage 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

Wolfram Cloud deployment guidelines

Using CloudDeploy with dependent functions

• If you need a temporary work-around supplying "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. – b3m2a1 May 22 '17 at 14:40
• @MB1965 yep, there is a bug with not handling default value, and some inconsistency because I see an initial (wrong) plot while for "name"->"spec" there isn't any map at all. So far I know the report was forwarded to developers. – Kuba May 22 '17 at 14:42
• I think the initial wrong plot may actually be coming from this 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. – b3m2a1 May 22 '17 at 14:45
• It seems it simply doesn't apply the Interpreter to the default value. Useful to know, but also a definite potential stumbling block. – b3m2a1 May 22 '17 at 14:47
• @MB1965 Yep probably. And yes, I know the full syntax behaves correctly but documentation shows examples where I don't have to specify full interpreter input or Entity objects. So while not critical, it is still a bug. – Kuba May 22 '17 at 14:47