【问题标题】:How can I get browser to prompt to save password using gwt bootstrap?如何让浏览器提示使用 gwt bootstrap 保存密码?
【发布时间】:2013-10-04 13:49:24
【问题描述】:

我有一个包含 gwt 引导文本框、密码文本框和提交按钮的登录页面

<g:VerticalPanel height="400px" width="50%">
                <b:WellForm  height="400px" ui:field="loginPanel">


                    <g:VerticalPanel horizontalAlignment="ALIGN_CENTER"
                        width="100%">
                        <b:FormLabel ui:field="emailErrorLabel" visible="false">
                            <font color="red">
                                <i>&nbsp;Please enter your login name</i>
                            </font>
                        </b:FormLabel>
                        <b:TextBox  alternateSize="LARGE" b:id="Email"
                            ui:field="Email" placeholder="E-mail"  width="335px"
                            height="30px" />
                    </g:VerticalPanel>


                    <g:VerticalPanel horizontalAlignment="ALIGN_CENTER" width="100%">
                        <b:FormLabel ui:field="passwordErrorLabel" visible="false">
                            <font color="red">
                                <i>&nbsp; Please enter password</i>
                            </font>
                        </b:FormLabel>
                        <b:PasswordTextBox  width="335px"
                            alternateSize="LARGE" ui:field="password" placeholder="Password"
                            height="30px" />
                    </g:VerticalPanel>
                    <b:Button type="PRIMARY" ui:field="loginButton" icon="SIGNIN">Login</b:Button></b:Wellform>

我正在设置以下属性

loginPanel.setMethod("POST");
    loginPanel.getElement().setPropertyString("autocomplete", "on");
    Email.getElement().setAttribute("type", "text");
    password.getElement().setAttribute("type", "password");

点击登录时,我正在调用一个 rpc,它会登录。我缺少什么属性。如何让浏览器提示保存密码选项。

【问题讨论】:

    标签: gwt twitter-bootstrap uibinder gwt-bootstrap


    【解决方案1】:

    为了让浏览器检测到可保存的密码,您必须具有以下 HTML:

    <form>
        <input type="text" />
        <input type="password" />
    </form>
    

    确保您的 GWT 代码在浏览器中编译成这些元素。 当该表单执行“提交”操作时,浏览器会要求保存密码。我认为既然你有一个点击处理程序来手动登录用户,而不是你的表单执行POST,浏览器不会意识到它是一个登录。

    另外,我相信你不需要这个:

    password.getElement().setAttribute("type", "password");
    

    因为&lt;b:PasswordTextBox 已经编译成&lt;input type="password" /&gt;。 “电子邮件”字段可能也不需要,但我不确定。

    【讨论】:

      猜你喜欢
      • 2011-01-23
      • 2013-12-23
      • 1970-01-01
      • 2011-11-04
      • 2012-02-26
      • 1970-01-01
      • 2011-01-24
      • 1970-01-01
      相关资源
      最近更新 更多