[英]Custom Submit button
如何創建提交按鈕,並在其上定義自定義標題以及自定義類樣式?
還記得,你可以隨時做舊學校
我更喜歡使用$this->Form->end( );
沒有參數並構建我自己的提交按鈕和標記。 這很簡單
<div class="buttons clearfix">
<button type="submit" class="positive">
<span class="icon-wrapper"><img src="path/to/tickmark.png" alt="" title="" /></span>
Save Item
</button>
</div>
我還會告訴你$this->Form->input('Model.field', 'options' => array( array('type' => 'button')));
- 特別是之前,之間,之后和類選項。 您可以使用幫助程序創建具有良好靈活性的<input type="button" />
元素。
您可以通過此代碼創建costum
echo $this->Form->submit(
'Submit',
array('div' => false,'class' => 'urclass', 'title' => 'Title')
);
這就夠了:
echo $this->Form->submit("Custom message");
同樣@Mike建議關閉表格
echo $this->Form->end();
我使用我的under app / webroot / img中的圖像創建了一個自定義按鈕,它使用內聯樣式指定大小並將位置更改為居中
$options=array('type'=>'Make secure payment', 'type'=>'image', 'style'=>'width:200px; height:80px; display:block; margin-left:auto; margin-right:auto;');
echo $this->Form->submit('/img/axiaepaysecurebuttongray_med.png', $options);
echo $this->Form->end();
對於CakePHP 2.x,您可以使用
$options = array(
'label' => 'Update',
'div' => array(
'class' => 'glass-pill',
)
);
echo $this->Form->end($options);
或者您可以將兩者結合使用:
echo $this->Form->end("Custom Message");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.