本文整理汇总了PHP中TbHtml::ajaxSubmitButton方法的典型用法代码示例。如果您正苦于以下问题:PHP TbHtml::ajaxSubmitButton方法的具体用法?PHP TbHtml::ajaxSubmitButton怎么用?PHP TbHtml::ajaxSubmitButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TbHtml
的用法示例。
在下文中一共展示了TbHtml::ajaxSubmitButton方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
echo TbHtml::ajaxSubmitButton('<i class="icon-fa-save icon-fa-large"></i> Save', 'js:$("#' . $formid . '").attr("action")', array('beforeSend' => 'js:function() {
// tampilkan loader progress
$("#loader").show();
}', 'dataType' => 'json', 'success' => 'js:function(data) {
// sembunyikan loader progress
$("#loader").hide();
if (data.status=="success") {
//tampilkan pesan sukses
successMsgBox(data.message);
// klik tombol cancel
$("#btncancel").trigger("click");
// refresh table grid view
$.fn.yiiGridView.update("' . $gridviewid . '");
// set default action form
$("#' . $formid . '").attr("action","' . $defaultaction . '");
// set default icon save
$("#btncommand").html("<i class=\'icon-fa-save icon-fa-large\'></i> Save");
}else if(data.status=="fail"){
errorMsgBox(data.message);
}else{
$.each(data,function(key,val){
// buang class success pada input dan tambahkan class error pada input
$("#"+key+"_em_").closest("div").prev().closest("div").removeClass("success").addClass("error");
// tampilkan pesan error
$("#"+key+"_em_").text(val);
$("#"+key+"_em_").show();
});
}
$("html, body").animate({ scrollTop: 0 }, "slow");
}', 'error' => 'js:function(data) {
// sembunyikan loader progress
$("#loader").hide();
// tampilkan jika status server error
errorMsgBox("An Error Ocurred Please Try Again");
$("html, body").animate({ scrollTop: 0 }, "slow");
}'), array('color' => TbHtml::BUTTON_COLOR_INVERSE, 'size' => TbHtml::BUTTON_SIZE_LARGE, 'id' => 'btncommand'));
示例2: testAjaxSubmitButton
public function testAjaxSubmitButton()
{
$I = $this->codeGuy;
$html = TbHtml::ajaxSubmitButton('Submit', '#', array(), array('class' => 'button', 'id' => 'button', 'name' => 'button'));
$button = $I->createNode($html, 'button[type=submit].btn');
$I->seeNodeCssClass($button, 'button');
$I->seeNodeAttributes($button, array('id' => 'button', 'name' => 'button'));
$I->seeNodeText($button, 'Submit');
}
示例3: array
echo Tbhtml::label('ID Member', 'id_member', array('class' => 'control-label', 'maxlength' => '7'));
?>
<div class="controls">
<?php
$this->widget('yiiwheels.widgets.maskinput.WhMaskInput', array('name' => 'id_member', 'mask' => '9999999', 'htmlOptions' => array('placeholder' => '')));
?>
<?php
echo TbHtml::ajaxSubmitButton('<i class="icon-fa-search icon-fa-large" style="margin-top:5px;"></i> Search', 'js:$("#form-search-member").attr("action")', array('type' => 'POST', 'data' => 'js:{id_member:$("#id_member").val()}', 'dataType' => 'json', 'success' => 'function(data) {
if(data){
$("#member_name").val(data.first_name + " " + data.family_name);
$("#point").val(data.point);
disableMember();
' . $additionalHandler . '
}else{
errorMsgBox("ID Member Not Found");
}
}'), array('id' => 'btn-search-member', 'color' => TbHtml::BUTTON_COLOR_INVERSE));
?>
</div>
</div>
<?php
echo TbHtml::textFieldControlGroup('member_name', '', array('span' => 5, 'label' => 'Member Name', 'readonly' => 'readonly'));
?>
示例4: array
</tbody>
</table>
<h5 style="text-align:right;margin-right:120px">Grand Total Point Earned : <span id="grandtotal">0</span></h5>
</div>
<div class="span-8" style="margin-left:-2px;margin-top:15px;">
<div class="form-actions" style="width:730px;">
<?php
echo TbHtml::ajaxSubmitButton('<i class="icon-fa-save icon-fa-large" style="margin-top:7px;"></i> Save', 'js:$("#form-addpoint").attr("action")', array('type' => 'POST', 'data' => 'js:$("#form-addpoint").serialize()+"&"+$.param({"id_member":$("#id_member").val().trim()})', 'dataType' => 'json', 'success' => 'function(data){
confirmMsgBox(data);
$("#btncancel").trigger("click");
$("html, body").animate({ scrollTop: 0 }, "slow");
}', 'error' => 'function(data){
errorMsgBox("Transaction add point failed, please try again!");
$("html, body").animate({ scrollTop: 0 }, "slow");
}'), array('color' => TbHtml::BUTTON_COLOR_INVERSE, 'size' => TbHtml::BUTTON_SIZE_LARGE, 'id' => 'btncommand'));
echo " ";
// Tombol untuk batal
echo TbHtml::resetButton('<i class="icon-fa-remove-circle icon-fa-large" style="margin-top:7px;"></i> Cancel', array('color' => TbHtml::BUTTON_COLOR_DEFAULT, 'size' => TbHtml::BUTTON_SIZE_LARGE, 'id' => 'btncancel'));
?>
</div>
</div>
<?php
echo TbHtml::endForm();
?>
示例5: defaultForm
<?php
/* @var $this UpgradeMembershipController */
Yii::app()->clientScript->registerScript('cleanForm', "\n\n// fungsi untuk membershikan form\nfunction defaultForm(){\n \$('#form-upgrade-membership').each(function(){\n this.reset();\n });\n\n \$('.alert-error').text('').hide();\n \$('#new_id_member').prop('readonly',false);\n \$('#btncommand').prop('disabled',false);\n \n}\n\n\n\n// Aksi pada saat tombol cancel diklik\n\$('#btncancel').click(function(e){\n e.preventDefault();\n defaultForm();\n defaultFormMember();\n});");
$handler = "\n var type_member = \$('#id_member').val().substring(0,1);\n if (type_member=='2'){\n \$('.alert-error').text('Member already upgraded').show();\n \$('#new_id_member').prop('readonly',true);\n \$('#btncommand').prop('disabled',true);\n }\n";
?>
<p class="alert alert-error" style="display:none"></p>
<?php
$this->renderPartial('//common/_member', array('additionalHandler' => $handler));
echo TbHtml::formTb(TbHtml::FORM_LAYOUT_HORIZONTAL, $this->createUrl('/transaction/UpgradeMembership/save'), 'post', array('id' => 'form-upgrade-membership'));
?>
<?php
echo TbHtml::textFieldControlGroup('new_id_member', '', array('span' => 3, 'label' => 'New ID Member'));
?>
<div class="form-actions">
<?php
echo TbHtml::ajaxSubmitButton('<i class="icon-fa-save icon-fa-large" style="margin-top:7px;"></i> Save', 'js:$("#form-upgrade-membership").attr("action")', array('type' => 'POST', 'data' => 'js:{id_member:$("#id_member").val(),new_id_member:$("#new_id_member").val()}', 'dataType' => 'json', 'success' => 'function(data){
successMsgBox(data.message);
$("#btncancel").trigger("click");
}'), array('color' => TbHtml::BUTTON_COLOR_INVERSE, 'size' => TbHtml::BUTTON_SIZE_LARGE, 'id' => 'btncommand'));
echo " ";
echo TbHtml::resetButton('<i class="icon-fa-remove-circle icon-fa-large" style="margin-top:7px;"></i> Cancel', array('color' => TbHtml::BUTTON_COLOR_DEFAULT, 'size' => TbHtml::BUTTON_SIZE_LARGE, 'id' => 'btncancel'));
?>
</div>
<?php
echo TbHtml::endForm();