簡體   English   中英

如何在不充當“提交”按鈕的表單中包含按鈕

[英]How to include a button within a form that does not act as the Submit button

我有一個表格,希望用戶填寫一些基本信息。 但是,在提交信息之前,我想添加一個我用來激活Stripe要求付款的按鈕。

到目前為止,我已經嘗試過此操作,但是,在提交按鈕之前,此按鈕用作提交按鈕。

這是一些代碼:

{{ Form::open(array('route' => 'fans.store')) }}

{{ Form::label('name', 'Name:') }}
{{ Form::text('name', null, array(
        'class'     => 'input',
        ));}}

{{ Form::label('email', 'Email:') }}
{{ Form::text('email', null, array(
        'class'     => 'input',
        ));}}

<div class="button_row">
<button id="customButton" class="button">Purchase</button>
</div>

<div class="button_row">
{{Form::submit('Submit', ['class' => 'button'])}}
</div>

{{Form::close()}}

有什么解決方法嗎? 語法是blade php(我正在使用Laravel 4)。 謝謝。

請嘗試以下操作:

{{ Form::button('purchase', 'Purchase with Stripe', array( 'id' => 'purchase', 'onclick'=>'myFunction()')) }}

這會創建一個購買按鈕,

  1. 標有“帶條紋購買”
  2. 調用啟動條帶的myFunction()
<button type="button">

參見: http : //www.w3schools.com/tags/att_button_type.asp

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM