Reputation: 13537
I have a view that generates a button:
$view->widget('bootstrap.widgets.TbButton', array(
'id' => 'removeButton',
'label' => $label,
'buttonType' => 'ajaxButton',
... etc
When the button is generated, and I inspect the code, I see:
<button name="yt0" id="yt0" class="btn btn-primary btn-large" data-loading-text="loading...." type="button">Add to Cart</button>
Why is both the name and id yt0 and not "removeButton" as I've specified?
Upvotes: 1
Views: 3965
Reputation: 527
Full example:
<?php
$this->widget('bootstrap.widgets.TbButton', array(
'buttonType' => 'submit',
'type' => $model->isNewRecord ? 'primary' : 'info',
'label' => $model->isNewRecord ? 'Create' : 'Save',
'loadingText' => 'Saving...',
'htmlOptions' => array('tabindex'=>7, 'id'=>'submit-button', 'class'=>'buttonStateful'),
));
?>
<script>
$('.buttonStateful').click(function() {
var btn = $(this);
btn.button('loading'); // call the loading function
setTimeout(function() {
btn.button('reset'); // call the reset function
}, 3000);
});
<
Upvotes: 0
Reputation: 13537
It should be:
$view->widget('bootstrap.widgets.TbButton', array(
'htmlOptions' => array('id'=> 'removeButton'),
etc
Upvotes: 5