File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -285,6 +285,13 @@ defmodule AshPhoenix.Form do
285
285
tenant: [
286
286
type: :any ,
287
287
doc: "The current tenant. Passed through to the underlying action."
288
+ ] ,
289
+ params: [
290
+ type: :any ,
291
+ default: % { } ,
292
+ doc: """
293
+ The initial parameters to use for the form. This is useful for setting up a form with default values.
294
+ """
288
295
]
289
296
]
290
297
Original file line number Diff line number Diff line change @@ -20,10 +20,19 @@ defmodule AshPhoenix.FormTest do
20
20
21
21
assert 0 =
22
22
Post
23
- |> Form . for_action ( :post_count , params: params )
23
+ |> Form . for_action ( :post_count )
24
24
|> Form . validate ( params )
25
25
|> Form . submit! ( params: params )
26
26
end
27
+
28
+ test "generic actions can accept initial params" do
29
+ params = % { containing: "hello" }
30
+
31
+ assert 0 =
32
+ Post
33
+ |> Form . for_action ( :post_count , params: params )
34
+ |> Form . submit! ( params: nil )
35
+ end
27
36
end
28
37
29
38
describe "drop_param" do
You can’t perform that action at this time.
0 commit comments