简体   繁体   English

Bootstrap 表单不会使用图像按钮提交

[英]Bootstrap form won't submit with image button

I have made a form with Bootstrap.我用 Bootstrap 制作了一个表格。 There is a image button to submit the form but when I click it, nothing happens.有一个用于提交表单的图像按钮,但是当我单击它时,什么也没有发生。

<form name="input" action="index.php" method="post" class="form-horizontal">                    
    <div class="input-group">
        <span class="input-group-addon">@</span>
        <input name="coins" type="text" class="form-control" placeholder="Quanity" >
    </div><br>
    <div class="input-group">
        <span class="input-group-addon">@</span>
        <input type="text" class="form-control" name="usd" placeholder="USD" >
    </div><br>
    <div class="input-group">
        <span class="input-group-addon">@</span>
        <input  type="text" class="form-control" name="paypal" placeholder="PayPal Address" >
    </div><br>
    <div class="input-group">
        <input type="image" src="/img/ppbutton.png" name="submit" alt="PayPal - The safer, easier way to pay online!">
    </div><br>
</form> 

Your submit button needs to be a button/submit and styled with CSS:您的提交按钮需要是一个按钮/提交并使用 CSS 设置样式:

<style>
div.submitter input {
    /*you will need to adjust your stylesheet so it looks the way you want.*/
    width: 100px;
    height: 40px;
    background-image: url(/img/ppbutton.png);
    background-repeat: no-repeat;
    border: 1px solid;
    }
</style>

<!-- REPLACE IN YOUR FORM -->
<div class="submitter"><input type="submit" name="submit" alt="PayPal - The safer, easier way to pay online!" /></div>

It submits the form but it sends values in the form of x and y coordinates of the image.它提交表单,但它以图像的 x 和 y 坐标的形式发送值。

For Example:例如:

<input type="submit" name="submit" alt="PayPal - The safer, easier way to pay online!" />

For this input DOM object it will send submit.x=[some integer] and submit.y=[some interger]对于这个输入 DOM 对象,它将发送submit.x=[some integer]submit.y=[some interger]

This is what I used:这是我使用的:

<button class="btn btn-default" type="submit" name="delete" value="delete">
     <img src="/delete.png" width="20" />
</button>

尝试添加 this.form.submit 如下:

<input type="image" onclick="this.form.submit()" src="/img/ppbutton.png" name="submit" alt="PayPal - The safer, easier way to pay online!">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM