Dojo登录表单-如何发送post方法

7kqas0il  于 2022-12-16  发布在  Dojo
关注(0)|答案(1)|浏览(153)

我已经下载了Dojo登录表单。我应该做些什么修改,以便当我单击Login按钮时,向index.php发送一个带参数的POST请求?

dojo.require("dijit.form.DropDownButton");
dojo.require("dijit.TooltipDialog");
dojo.require("dijit.form.TextBox");
dojo.require("dijit.form.Button");
<link href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.3/dojo/resources/dojo.css" rel="stylesheet" />
<link href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.3/dijit/themes/claro/claro.css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.9.3/dojo/dojo.js" djConfig="parseOnLoad:true"></script>

<body class="claro">
      <div dojoType="dijit.form.DropDownButton" class="soria" style="float:right;">
                    <span>Login</span>
                    <div dojoType="dijit.TooltipDialog" id="dialog1"
                         title="Login Form" execute="checkPw(arguments[0]);">
                        <table>
                            <tr>
                                <td><label for="name" title="User name">
                                        Username</label></td>
                                <td><input dojoType="dijit.form.TextBox"
                                           type="text" name="oldpw"></td>
                            </tr>
                            <tr>
                                <td><label for="loc">Password: </label></td>
                                <td><input dojoType="dijit.form.TextBox"
                                           type="password" name="newpw"></td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center">
                                    <button dojoType="dijit.form.Button"
                                            type="submit">Login</button></td>
                            </tr>
                        </table>
                    </div>
    
                </div>
pn9klfpd

pn9klfpd1#

您需要添加带有action的表单标签

<div dojoType="dijit.form.DropDownButton" class="soria" style="float:right;">
                <span>Login</span>
                <div dojoType="dijit.TooltipDialog" id="dialog1"
                     title="Login Form" execute="checkPw(arguments[0]);">
                   <form id="login_form" method="POST" action="index.php">
                    <table>
                        <tr>
                            <td><label for="name" title="User name">
                                    Username</label></td>
                            <td><input dojoType="dijit.form.TextBox"
                                       type="text" name="oldpw"></td>
                        </tr>
                        <tr>
                            <td><label for="loc">Password: </label></td>
                            <td><input dojoType="dijit.form.TextBox"
                                       type="password" name="newpw"></td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                                <button dojoType="dijit.form.Button"
                                        type="submit">Login</button></td>
                        </tr>
                    </table>
                   </form>
                </div>

            </div>

相关问题