Html 合并多个表单数据
我正在用django创建一个信用卡支付页面。用户可以选择填写信用卡信息或使用以前输入的卡。但是,用户必须选择一个位置 有没有办法创建表单,这样我就不必有两个单独的位置“选择”按钮 HTML:Html 合并多个表单数据,html,forms,Html,Forms,我正在用django创建一个信用卡支付页面。用户可以选择填写信用卡信息或使用以前输入的卡。但是,用户必须选择一个位置 有没有办法创建表单,这样我就不必有两个单独的位置“选择”按钮 HTML: 条纹收费10美元 {%csrf_令牌%} {%如果不是user.is_身份验证%} 全名 电子邮件 电话 {%endif%} 位置 缪尔 ERC 马歇尔 沃伦 雷维尔 第六 卡号 CVC 有效期(年月日) / {%if user.u经过身份验证%} 保存这张卡 {%endif%} 付款 {%如果user.
条纹收费10美元
{%csrf_令牌%}
{%如果不是user.is_身份验证%}
全名
电子邮件
电话
{%endif%}
位置
缪尔
ERC
马歇尔
沃伦
雷维尔
第六
卡号
CVC
有效期(年月日)
/
{%if user.u经过身份验证%}
保存这张卡
{%endif%}
付款
{%如果user.u经过身份验证并且user.get\u profile.stripe\u customer\u id%}
或:
使用以:4343结尾的卡片
{%csrf_令牌%}
位置
缪尔
ERC
马歇尔
沃伦
雷维尔
第六
付款
{%endif%}
您可以通过各自表单的提交事件处理程序中的JavaScript(使用jQuery时可能非常容易)检索所选位置
<h1>Charge $10 with Stripe</h1>
<!-- to display errors returned by createToken -->
<span class="payment-errors"></span>
<form action="" method="POST" id="payment-form">
{% csrf_token %}
{% if not user.is_authenticated %}
<div class="form-row">
<label>Full Name</label>
<input type="text" size="30" autocomplete="off" name="fullname" />
</div>
<div class="form-row">
<label>Email</label>
<input type="text" size="30" autocomplete="off" name="email" />
</div>
<div class="form-row">
<label>Phone</label>
<input type="text" size="11" autocomplete="off" name="phone" />
</div>
{% endif %}
<label>Location</label>
<select name="location">
<option value="muir">Muir</option>
<option value="erc">ERC</option>
<option value="marshall">Marshall</option>
<option value="warren">Warren</option>
<option value="revelle">Revelle</option>
<option value="sixth">Sixth</option>
</select>
<div class="form-row">
<label>Card Number</label>
<input type="text" size="20" autocomplete="off" class="card-number" />
</div>
<div class="form-row">
<label>CVC</label>
<input type="text" size="4" autocomplete="off" class="card-cvc" />
</div>
<div class="form-row">
<label>Expiration (MM/YYYY)</label>
<input type="text" size="2" class="card-expiry-month"/>
<span> / </span>
<input type="text" size="4" class="card-expiry-year"/>
</div>
{% if user.is_authenticated %}
<input type="checkbox" name="save_card_info" value="yes"/> Save this card </br>
{% endif %}
<button type="submit" class="submit-button">Submit Payment</button>
</form>
{% if user.is_authenticated and user.get_profile.stripe_customer_id %}
</br>
OR:
</br>
</br>
Use card ending with: 4343
<form action="" method="POST">
{% csrf_token %}
<label>Location</label>
<select name="location">
<option value="muir">Muir</option>
<option value="erc">ERC</option>
<option value="marshall">Marshall</option>
<option value="warren">Warren</option>
<option value="revelle">Revelle</option>
<option value="sixth">Sixth</option>
</select>
</br>
<input type="hidden" name="action=" value="pay_saved_card"/>
<button type="submit">Submit Payment</button>
</form>
{% endif %}
</body>