我有这个框架集部门:
<frameset cols="*,200">
<frame name="main" src="/main.html">
<frame name="sidebar" src="/sidebar">
</frameset>
这是我的elm
逻辑位于main.html
:
import Html exposing (..)
import Html.Attributes exposing (..)
view : Model -> Html Msg
view model =
Html.form [method "POST", action "/sidebar", target "sidebar" ]
[ input [ type_ "text" ,placeholder "user"] [],
input [ type_ "password", placeholder "password"] [],
input [ type_ "submit" ,value "Submit"] []
]
我想从我的代码中调用表单提交。
如何从elm
触发提交表单?
修改
这就是我想出来的,非常难看:
submit2frame frm = attribute "onclick" ("javascript:this.form.target=" ++ frm ++ ";this.form.action=\"/" ++ frm ++ "\";this.form.submit();")