FormPage[formspec,func]
フォームから入力を取り,formspec で定義された構造を持つフォームから得られた値に func を適用することで同じページ上に結果を生成するアクティブなページを表す.
FormPage[{"name1"type1,…},func]
フィールドがタイプ typeiとして解釈された nameiに因んで名付けられたアクティブなフォームページを表す.
FormPage[{{"name1",label1}type1,…},func]
nameiという名前のフィールドのラベルとして labeliを使う.
FormPage[{namespec1type1default1,…},func]
namespeciで指定されたフィールドのデフォルトとして defaultiを使う.
FormPage[formspec,func,form]
レイアウト指定 form に従ってページをレイアウトする.
FormPage[formspec,func,initformresform]
uses initform を初期レイアウトと指定として,resform を結果ページのレイアウト指定として使う.
FormPage
フィールドタイプのリスト »FormPage[formspec,func]
フォームから入力を取り,formspec で定義された構造を持つフォームから得られた値に func を適用することで同じページ上に結果を生成するアクティブなページを表す.
FormPage[{"name1"type1,…},func]
フィールドがタイプ typeiとして解釈された nameiに因んで名付けられたアクティブなフォームページを表す.
FormPage[{{"name1",label1}type1,…},func]
nameiという名前のフィールドのラベルとして labeliを使う.
FormPage[{namespec1type1default1,…},func]
namespeciで指定されたフィールドのデフォルトとして defaultiを使う.
FormPage[formspec,func,form]
レイアウト指定 form に従ってページをレイアウトする.
FormPage[formspec,func,initformresform]
uses initform を初期レイアウトと指定として,resform を結果ページのレイアウト指定として使う.
詳細とオプション
- CloudDeploy[FormPage[…]]は,アクティブなフォームページを含むクラウドオブジェクトを与える.
- FormPage[formspec,func][<|"namek"->inputk,…|>]は,与えられた入力をFormPageオブジェクトで指定された初期フォームに挿入する.
- Setting[FormPage[formspec,func]]は,フォームの現行値に適用された func を評価する.
- FormPage[formspec,func,layout]の layout の可能な指定には以下がある.
-
"ResultBelow" フォームの下に結果を表示する "ResultAbove" フォームの上に結果を表示する {elem1,elem2,…} レイアウト要素を指定順に表示 - FormPage[formspec,func,{elem1,elem2,…}]の可能な elemiには以下がある.
-
"Form" formspec で指定されたフォーム "Result" func を適用して生成された結果 "Button" フォームを送信するボタン - FormPageの全体的なオプション
-
AppearanceRules Automatic 全体的な外観規則を与える連想 FormLayoutFunction Automatic フォームのレイアウトを生成する関数 FormProtectionMethod Automatic スパム保護のメソッド PageTheme Automatic フォームに使う全体的なテーマ ImageFormattingWidth $ImageFormattingWidth 出力フォーマッティングの折返し幅 ImageSize Automatic 出力についての全体的な画像サイズ
例題
すべて開く すべて閉じる例 (1)
FormPageを使って連続的にWebページとインタラクトする:
CloudDeploy[FormPage["country" -> "Country", GeoGraphics[#country]&]]スコープ (31)
インタープリタの指定 (6)
豊かなInterpreter指定を使う:
CloudDeploy[FormPage[{"x" -> Restricted["Integer", {1, 10}]}, func]]Interpreterの頭部は任意であるが,Interpreterに対するオプションやその他の引数の指定に便利である:
CloudDeploy[FormPage[{"x" -> Interpreter["StructuredDate", TimeZone -> 2], "y" -> Interpreter[ToExpression, Positive]}, func]]CloudDeploy[FormPage[{"x" -> {1, 2, 3}}, func]]CloudDeploy[FormPage[{"question" -> {"Yes" -> True, "No" -> False}}, func]]CloudDeploy[FormPage[{"Country" -> EntityList["Country"]}, func]]CloudDeploy[FormPage[{"Image" :> Map[ImageResize[ExampleData[#], {100, 100}] &, ExampleData["TestImage"][[1 ;; 6]]]}, Composition[EdgeDetect, First]]]CloudDeploy[FormPage[{"x" -> {"A" -> 1, "B" -> 2, "C" -> 3}}, func]]デフォルト (3)
フィールドのデフォルトを指定する.デフォルトがあるフィールドには必要ない:
Setting @ FormPage[{"first" -> "String", "second" -> "Number" -> 3}, f]["first" -> "str"]Setting@FormPage[{"first" -> "String", "second" -> <|"Interpreter" -> "Number", "Required" -> False|>}, f]["first" -> "str"]RuleDelayedを使って毎回新たなデフォルトを評価する:
Setting@FormPage[{"name" -> "String", "date" -> <|"Interpreter" -> "DateTime", "Default" :> DateObject[]|>}, f][<|"name" -> "Bob", "date" -> None|>]入力 (2)
ラベル (1)
CloudDeploy[FormPage[{"x", "First Name"} -> "String", Identity]]RuleDelayedを使って任意の式を返すことができる:
CloudDeploy[FormPage["pc" -> <|"Label" :> "PC: " <> $MachineID|>, Identity]]CloudDeploy[FormPage[
"pc" -> <|"Label" :> GeoGraphics[
$GeoLocation,
GeoRange -> Quantity[2, "Miles"]
]|>,
Identity
]]Noneを使ってラベルを削除する:
CloudDeploy[FormPage["Query" -> <|"Label" -> None, "Hint" -> "Search"|>, Identity]]CloudDeploy[FormPage[{
"First" -> <|"Label" -> None, "Hint" -> "First Name"|>,
"Last" -> <|"Label" -> None, "Hint" -> "Last Name"|>
}, Identity]]外観 (4)
CloudDeploy[FormPage[{"key", "Label"} -> "Integer", g]]CloudDeploy[FormPage[{"Number", [image]} -> "Number", g]]CloudDeploy[FormPage[{"x" -> <|"Interpreter" -> Restricted["Integer", {1, 10}], "Control" -> InputField, "Help" -> "help text", "Hint" -> "write something"|>}, func]]RuleDelayedを使って式をクラウドで評価する:
CloudDeploy[FormPage[{"x" -> <|"Label" -> "Where are you?", "Help" :> GeoGraphics[$GeoLocation]|>}, func]]CloudDeploy[FormPage[{"x" -> "String", "text", Graphics3D[Sphere[]], "y" -> "Integer"}, func]]コントロール (7)
タイプによってコントロールが異なる."Color"のカラーピッカー:
CloudDeploy[FormPage[{"x" -> "Color"}, func]]CloudDeploy[FormPage[{"x" -> "Image"}, func]]CloudDeploy[FormPage[{"x" -> "Boolean"}, func]]CloudDeploy[FormPage[{"x" -> <|"Interpreter" -> Restricted["Integer", {1, 10}], "Control" -> Slider|>}, func]]CloudDeploy[FormPage[FormObject[<|"x" -> <|"Interpreter" -> {"A" -> 1, "B" -> 2, "C" -> 3}, "Control" -> RadioButtonBar|>|>], func]]CloudDeploy[FormPage[FormObject[<|"x" -> <|"Interpreter" -> {Plot[Sin[x], {x, 0, 10}] -> 1, Graphics3D[Sphere[]] -> 2, EntityValue[Entity["Species", "Species:FelisCatus"], EntityProperty["Species", "Image"]] -> 3}, "Control" -> RadioButtonBar|>|>], func]]CloudDeploy[FormPage[{"x" -> <|"Interpreter" -> "String", "Control" -> Function[Tooltip[InputField[##], EntityValue[Entity["Species", "Species:FelisCatus"], EntityProperty["Species", "Image"]]]]|>}, func]]曖昧性の除去 (3)
Wolframクラウドで自然言語から解釈された文字列は曖昧なことがある:
CloudDeploy[FormPage["where" -> "City", func]["where" -> "springfield"]]デフォルトで,ほとんどのタイプで曖昧性の除去が無効になっているが,これは簡単に有効にすることができる:
CloudDeploy[FormPage["amount" -> <|"Interpreter" -> "Quantity", "Disambiguation" -> All|>, func]["amount" -> "2 ounces"]]CloudDeploy[FormPage["expr" -> <|"Interpreter" -> "SemanticExpression", "Disambiguation" -> All|>, func]["expr" -> "log log 3"]]動的フォーム (1)
TemplateSlotを含むフォームの部分は,TemplateSlot[key]で言及されたキーが適切な値に結びつけられない限り評価されない:
FormPage[{{"name", "what's your name?"} -> "GivenName", "gender" -> <|"Interpreter" -> {"Male", "Female"}, "Input" -> TemplateIf[TemplateSlot["name"][[-1, -1]] == "male", "Male", "Female"]|>}]レイアウト (4)
CloudDeploy[FormPage["x" -> "Integer", #x!&, "ResultBelow"]]CloudDeploy[FormPage["x" -> "Integer", #x!&, "ResultAbove"]]CloudDeploy[FormPage["x" -> "Integer", #x!&, {"Button", "Form", "Result"}]][image]CloudDeploy[FormPage["x" -> "Integer", #x!&, {"Form", "Button"} -> {"Button", "Form", "Result"}]]オプション (6)
AppearanceRules (1)
CloudDeploy[FormPage["Start" -> "Country", func, AppearanceRules -> <|"Title" -> "Where do you want to go?", "Description" -> "Enter a country and we will find you an accomodation"|>]]CloudDeploy[FormPage["Product" -> {"Flyers", "Business cards", "Leflets"}, func, AppearanceRules -> <|"Title" -> [image], "Description" -> "What do you want to print today?"|>]]"ItemLayout"を使ってフォームフィールドの外観を変える:
CloudDeploy[FormPage[{"First" -> "String", "Second" -> "String"}, func, AppearanceRules -> <|"ItemLayout" -> "Vertical"|>]]CloudDeploy[FormPage[{"First" -> <|"Help" -> "Insert a value"|>, "Second" -> <|"Help" -> "Insert a value"|>}, func, AppearanceRules -> <|"ItemLayout" -> "Inline"|>]]CloudDeploy[FormPage["Product" -> {"Flyers", "Business cards", "Leflets"}, func, AppearanceRules -> <|"SubmitLabel" -> "Buy now!"|>]]FormLayoutFunction (1)
PageTheme (4)
CloudDeploy[FormPage[{"age" -> "Number"}, First, PageTheme -> "White"]]CloudDeploy[FormPage[{"age" -> "Number"}, First, PageTheme -> "Blue"]]CloudDeploy[FormPage[{"age" -> "Number"}, First, PageTheme -> "Black"]]CloudDeploy[FormPage[{"age" -> "Number"}, First, PageTheme -> "Red"]]アプリケーション (2)
CloudDeploy[FormPage[{"from" -> "Airport", "to" -> "Airport"}, GeoGraphics[GeoPath[{GeoPosition[#from], GeoPosition[#to]}]]&]]CloudDeploy @ FormPage[{
"city" -> <|"Interpreter" -> "City", "Input" -> "NYC"|>,
"years" -> <|
"Input" -> "2000 - 2010",
"Interpreter" -> Restricted[
DelimitedSequence[
Restricted["Integer", {1900, 2014}],
"-"
],
{1, 2}
]|>
},
Module[{data, range},
range = Range @@ PadRight[Sort[#years], 2, First[#years]];
data = EntityValue[
#city,
Table[
EntityProperty[
"City",
"Population",
{"Date" -> DateObject[{year}]}
],
{year, range}
]
];
Grid @ Transpose[{range, data}]
]
&,
AppearanceRules -> <|
"Title" -> "Demographic data",
"Description" -> "Enter any city and a date range."
|>
]特性と関係 (9)
FormPageはFormFunctionと互換になるように設計されている:
CloudDeploy[FormPage @@ FormFunction["x" -> "String", Identity]]FormPageはAPIFunctionと互換になるように設計されている:
CloudDeploy[FormPage @@ APIFunction["x" -> "String", Identity]]CloudDeploy[APIFunction @@ FormPage["x" -> "String", Identity]]FormPageの第1引数は完全なFormObjectとして与えることができる:
FormPage[FormObject["x" -> "Integer"], Identity]第1引数が完全なFormObjectになるようにFormPageを評価する:
FormPage["x" -> "String", Identity]//InputFormFormPageの単一のフィールドが,Interpreterを使ってWolfram言語式の入力を変換する:
f1 = FormPage["x" -> "Country", #x&]f2 = FormPage["x" -> Interpreter["Country"], #x&]AnySubsetを使って複数の選択肢が選べるコントローラを生成することができる:
CloudDeploy[FormPage[
{"choose one or more" -> AnySubset[{1, 2, 3}]}]]RepeatingElementを使って,加えたり削除したりできるフィールドの集合を生成することができる:
CloudDeploy[FormPage["field" -> RepeatingElement["String", {2, {1, 5}}]]]CompoundElementを使ってフィールドの拡張可能な表を作ることができる:
CloudDeploy[FormPage["names" -> RepeatingElement[CompoundElement[<|"first" -> "String", "last" -> "String"|>]]]]考えられる問題 (2)
Interpreter["String"]は空の文字列を取る.これは,空の文字列と空のフィールドが等しいとみなすFormPageには当てはまらない:
Interpreter["String"][""]FormPage[{"a string" -> "String"}, f][{"a string" -> ""}]クラウド評価には,メモリ使用量と評価時間の制限がある.FormPageの制限はユーザのクラウドプランによって決定される.具体的な数値はCloudAccountDataの"DeployedMemoryLimit"および"DeployedEvaluationTimeLimit"で確認できる:
CloudAccountData /@ {"DeployedMemoryLimit", "DeployedEvaluationTimeLimit"}関連するガイド
関連するワークフロー
- 繰り返し使うフォームのページを設定する ▪
- 複数ページからなるフォームを構築する ▪
- スライダー等のコントロールを含むフォームを作る
テキスト
Wolfram Research (2015), FormPage, Wolfram言語関数, https://reference.wolfram.com/language/ref/FormPage.html.
CMS
Wolfram Language. 2015. "FormPage." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FormPage.html.
APA
Wolfram Language. (2015). FormPage. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FormPage.html
BibTeX
@misc{reference.wolfram_2026_formpage, author="Wolfram Research", title="{FormPage}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/FormPage.html}", note=[Accessed: 05-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_formpage, organization={Wolfram Research}, title={FormPage}, year={2015}, url={https://reference.wolfram.com/language/ref/FormPage.html}, note=[Accessed: 05-November-2026]}