@@ -78,8 +78,8 @@ defprotocol Phoenix.HTML.FormData do
7878end
7979
8080defimpl Phoenix.HTML.FormData , for: Map do
81- def to_form ( conn_or_atom_or_map , opts ) do
82- { name , params , opts } = name_params_and_opts ( conn_or_atom_or_map , opts )
81+ def to_form ( map , opts ) do
82+ { name , params , opts } = name_params_and_opts ( map , opts )
8383 { errors , opts } = Keyword . pop ( opts , :errors , [ ] )
8484 { action , opts } = Keyword . pop ( opts , :action , nil )
8585 id = Keyword . get ( opts , :id ) || name
@@ -89,7 +89,7 @@ defimpl Phoenix.HTML.FormData, for: Map do
8989 end
9090
9191 % Phoenix.HTML.Form {
92- source: conn_or_atom_or_map ,
92+ source: map ,
9393 impl: __MODULE__ ,
9494 id: id ,
9595 name: name ,
@@ -115,14 +115,14 @@ defimpl Phoenix.HTML.FormData, for: Map do
115115 end
116116 end
117117
118- def to_form ( conn_or_atom_or_map , form , field , opts ) when is_atom ( field ) or is_binary ( field ) do
118+ def to_form ( map , form , field , opts ) when is_atom ( field ) or is_binary ( field ) do
119119 { default , opts } = Keyword . pop ( opts , :default , % { } )
120120 { prepend , opts } = Keyword . pop ( opts , :prepend , [ ] )
121121 { append , opts } = Keyword . pop ( opts , :append , [ ] )
122122 { name , opts } = Keyword . pop ( opts , :as )
123123 { id , opts } = Keyword . pop ( opts , :id )
124124 { hidden , opts } = Keyword . pop ( opts , :hidden , [ ] )
125- { action , opts } = Keyword . pop ( opts , :action )
125+ { action , opts } = Keyword . pop ( opts , :action , form . action )
126126
127127 id = to_string ( id || form . id <> "_#{ field } " )
128128 name = to_string ( name || form . name <> "[#{ field } ]" )
@@ -133,7 +133,7 @@ defimpl Phoenix.HTML.FormData, for: Map do
133133 is_map ( default ) ->
134134 [
135135 % Phoenix.HTML.Form {
136- source: conn_or_atom_or_map ,
136+ source: map ,
137137 impl: __MODULE__ ,
138138 id: id ,
139139 name: name ,
@@ -160,7 +160,7 @@ defimpl Phoenix.HTML.FormData, for: Map do
160160 index_string = Integer . to_string ( index )
161161
162162 % Phoenix.HTML.Form {
163- source: conn_or_atom_or_map ,
163+ source: map ,
164164 impl: __MODULE__ ,
165165 index: index ,
166166 action: action ,
@@ -175,7 +175,7 @@ defimpl Phoenix.HTML.FormData, for: Map do
175175 end
176176 end
177177
178- def input_value ( _conn_or_atom_or_map , % { data: data , params: params } , field )
178+ def input_value ( _map , % { data: data , params: params } , field )
179179 when is_atom ( field ) or is_binary ( field ) do
180180 key = field_to_string ( field )
181181
@@ -185,7 +185,7 @@ defimpl Phoenix.HTML.FormData, for: Map do
185185 end
186186 end
187187
188- def input_validations ( _conn_or_atom_or_map , _form , _field ) , do: [ ]
188+ def input_validations ( _map , _form , _field ) , do: [ ]
189189
190190 # Normalize field name to string version
191191 defp field_to_string ( field ) when is_atom ( field ) , do: Atom . to_string ( field )
0 commit comments