2013-08-22 92 views
0

如何将表单提交到同一个域中没有表单ID或名称的另一个页面?将表单提交到同一个域中的另一个页面

表格需要提交到另外一个页面:

<form id="login_form" action="roundcube" method="post"> 
    <div class="input-req-login"> 
     <label for="user">Email Address</label> 
    </div> 
    <div class="input-field-login icon username-container"> 
     <input name="_user" 
       id="rcmloginuser" 
       autofocus="autofocus" 
       placeholder="Enter your email address." 
       class="std_textbox" 
       type="text" 
       tabindex="1" required> 
    </div> 
    <div style="margin-top:30px;" class="input-req-login"> 
     <label for="pass">Parola</label> 
    </div> 
    <div class="input-field-login icon password-container"> 
     <input name="_pass" 
       id="rcmloginpwd" 
       placeholder="Enter your email password." 
       class="std_textbox" 
       type="password" 
       tabindex="2" required> 
    </div> 
    <div class="controls"> 
     <div class="login-btn"> 
      <button type="submit" 
        onclick="document.getElementByName("form").submit()" 
        tabindex="3">Autentificare</button> 
     </div> 

目标形式:

<form name="form" action="./" method="post"> 
    <input type="hidden" name="_token" value="543e98f5e6cc25841fc0df79cb939590"> 
    <input type="hidden" name="_task" value="login"> 
    <input type="hidden" name="_action" value="login"> 
    <input type="hidden" name="_timezone" id="rcmlogintz" value="_default_"> 
    <input type="hidden" name="_url" id="rcmloginurl" value=""> 
    <table> 
     <tbody> 
      <tr> 
       <td class="title"> 
        <label for="rcmloginuser">Utilizator</label> 
       </td> 
       <td class="input"> 
        <input name="_user" 
         id="rcmloginuser" 
         size="40" 
         autocapitalize="off" 
         autocomplete="off" 
         type="text"> 
       </td> 
      </tr> 
      <tr> 
       <td class="title"> 
        <label for="rcmloginpwd">Parolă</label> 
       </td> 
       <td class="input"> 
        <input name="_pass" 
          id="rcmloginpwd" 
          size="40" 
          autocapitalize="off" 
          autocomplete="off" 
          type="password"> 
       </td> 
      </tr> 
     </tbody> 
    </table> 
    <p class="formbuttons"> 
     <input type="submit" 
       class="button mainaction" 
       value="Autentificare" /> 
    </p> 
</form> 
+0

需要知道更多的答案。例如你使用什么语言?你为什么有两种形式?什么页面作为您的表单的目标?什么是后期? –

+0

我编辑它的代码,我发现roundcoube邮件有形式的名称,但仍然无法正常工作。 – Blazer

回答

0

我不能肯定我明白你的问题,但我猜你正在编写一个新的一页,想要发布到另一个页面。如果你这样做呢?

<form id="login_form" action="http://webmail.mysite.com/roundcube/" method="post"> 
+0

我刚刚做到了,带有roundcube的新页面打开,但只有用户字段存在,密码不可用,也不受限制。我需要从第1页登录到第2页,并打开第2页,该页面应该已登录。 – Blazer

1

好的,我现在看看你的网站。这其实很简单。

我想你要做的是建立一个个性化的网站登录,所以你可以给你自己的外观和感觉。和roundcube,我想这是你安装的标准邮件系统?

那么问题是,roundcube不仅发送用户名和密码。如果你看的HTML代码,也可以看到:

<input type="hidden" name="_token" value="5b6a757df5eee91fa7ee7171466b8b2a"> 
<input type="hidden" name="_task" value="login"> 
<input type="hidden" name="_action" value="login"> 
<input type="hidden" name="_timezone" id="rcmlogintz" value="_default_"> 
<input type="hidden" name="_url" id="rcmloginurl" value=""> 

所有这一切都是自动的日志中POST发送这些被隐藏的值。您可能需要添加最后4个。

尽管你可能有一个大问题。第一个叫_token我有一个理论,这是一个随机的字符串,服务器将要求您提供。我可能是错的,但如果我是正确的,你将无法做到你想要的。有这个随机字符串的原因是为了防止用户从其他表单登录(也就是说,如果我是正确的)

也许你可能关闭这个随机化的字符串在roundcube管理设置?如果不是,我认为除非您想深入研究圆形立方体的代码,否则您没有简单的方法继续。

编辑:我只是尝试提交没有_token的原始表单,它不起作用。很遗憾,这次你倒霉了。

+0

谢谢您的时间澄清事情。 – Blazer

相关问题