[EXTENSION] Bootstrap

@Xuntar:

  1. I just specified the type as it is on the demo page:( … I’ll try to download the current version of this extension again. Maybe that helps…

  2. Thank for looking inside the issue. I figured out, that the submit button does not submit the form via post. If I check Yii::app()->request->isPostRequest in my controller, it is false. I think thats why $_POST[ajax] is empty as well. :(


Got it. The submit button is connected to an ID I used before. I need to replace the submit button ID with a new one. How can I achive this? That does not work:




'htmlOptions' => array(

                	'id' => 'submitForm',

            	)



The first problem is still a secret for me…

@Chris83:

There is an error in BootButton.php (Line: 211). It calls the Chtml:ajaxSubmitButton method with the wrong count of parameters. There is the url missing, thats why my htmlOptions/ajaxOptions are passed into the wrong variables.

Can you fix that. It costs me a lot of time to figure that out. Anyway, a great extension :)


This error is the solution to my former problem. So consider this issue als solved :) The next problem is waiting in the next post…

I’ve got another problem, and I don’t know if this has something to do with the extension or with Yii in general. I’ve an ajax-driven site, which loads partials. So, f. ex. i load a new partial with a form within. But the submit button, which is rendered via BootButton as “ajaxSubmit” has no genererated javascript at the end of the page, or at least inside the new partial.




<?php $this->widget('bootstrap.widgets.BootButton', array(

            	'fn'=>'ajaxSubmit',

            	'url' => $this->createUrl('/user/edit',

                                            	array('id'=>$user->id,

                                                  	'division'=>'profile')

                                        	),

            	'label'=>'Save profile',

            	'type'=>'primary',

            	'size'=>'small',

            	'ajaxOptions'=>array(

                	'update' => '#yw5_tab_2',

            	),

            	'htmlOptions' => array(

                	'id' => 'submitFormBtn',

                	'name' => 'submitFormBtn',

            	)

        	)); ?>



Usually the javascript for the button should be placed within the site via registerScript(). Can I somehow force, to generated the javascript for the button to submit the form via ajax?

Try setting the last parameter of renderPartial to true. That should do the trick.

Thanks!! That did it :)

Hello,

when I use the BootModal with a form inside, the submit button in the modal footer does not submit the form, as it is obviously not inside. How can I manage that the submit button submits the form that is inside the modal body which is a partial?




<div class="modal-header">

            	<a class="close" data-dismiss="modal">&times;</a>

            	<h3>Create new external account</h3>

 </div>

 <div class="modal-body">

            	<p>

                	<?php echo $this->renderPartial('//partials/user/account/external/_new', array('extAcc'=>$extAcc), true); ?>

            	</p>

  </div>

  <div class="modal-footer">

            	<?php $this->widget('bootstrap.widgets.BootButton', array(

            	'fn'=>'ajaxSubmit',

            	'url' => $this->createUrl('/user/createExternalAccount'),

            	'label'=>'Create',

            	'type'=>'primary',

            	'size'=>'small',

            	'ajaxOptions'=>array(

                	'update' => '#yw5_tab_3',

            	),

            	'htmlOptions' => array(

                	'id' => 'createExternalAccount',

                	'name' => 'createExternalAccount',

            	)

        	)); ?>

            	<?php echo CHtml::link('Close', '#', array('class'=>'btn', 'data-dismiss'=>'modal')); ?>

  </div>



Have you tried to bind a click action to the submit button that submits the form?

No I did not. There Yii-generated javascript is that:




$('body').on('click','#createExternalAccountBtn',function(){jQuery.ajax({'type':'POST','url':'/user/createExternalAccount','cache':false,'data':jQuery(this).parents("form").serialize(),'success':function(html){jQuery("#yw5_tab_3").html(html)}});return  false;});



How can I bind the right form to my button?

Hi Chris,

I’ve noticed a slight problem when using BootActiveForm with tabular input. If the field fails validation, the ‘error’ css class is not being applied to the ‘control-group’ div, only an empty space is. It results in the source code just being:


<div class="control-group ">

When it should obviously be:


<div class="control-group error">

The ‘error’ class is successfully being applied to the field’s label though.

The part in my view concerned is:




<?php foreach($routineExercise as $i=>$item): ?>

<div id="input" class="routine_exercise">

	<?php echo $form->dropDownListRow($item, "[$i]exercise_id", CHtml::listData(Exercise::model()->findAll(array(

	'condition'=>'(user_id IS NULL) OR user_id='.Yii::app()->user->id, 

	'order'=>'target_muscle')), 

	'id', 'name', 'target_muscle'), 

	array('prompt'=>'Select exercise…')); ?>

	 <?php echo $form->textFieldRow($item, "[$i]sets", array('hint'=>'The number of sets for this exercise. You will define each set\'s target reps on the next page.')); ?>

</div>

<?php endforeach; ?>



Any ideas on how to solve this?

Awesome plugin, thank you for your work so far!

Hello, Chris83, I have one problem! ( On every page I have javascript error

file: $("body").on is not a function

: .../assets/8a27e561/js/bootstrap-typeahead.js

string: 263

$(‘body’).on(‘focus.typeahead.data-api’, ‘[data-provide=“typeahead”]’, function (e) {)

But I have always connected Jquery

in Firebug

GET jquery.js

200 OK

GET bootstrap-transition.js

200 OK

GET bootstrap-tooltip.js

200 OK

GET bootstrap-popover.js

200 OK

GET bootstrap-typeahead.js

200 OK

in layout integration




<?php $this->widget('ext.bootstrap.widgets.BootTypeahead', array(

    'options'=>array(

        'source'=>array('Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Dakota', 'North Carolina', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'),

        'items'=>4,

        'matcher'=>"js:function(item) {

            return ~item.toLowerCase().indexOf(this.query.toLowerCase());

        }",

    ),

)); ?>



You may know the reason? Thank you!

@Tureckiy: Have you tried using "jQuery" instead of "$"? It might be that $ is overridden by something else.

Im still wondering why the hell drop down views has 50% of the height of the buttons using the same code as in the examples…

Have you tried removing all other styles, it might that something sets them as "display: inline", that would explain the height issue.

hello

I have some problems with the extension bootstrap.

I installed this extension and i configured it.

I reload the index and the theme (css, img) didn’t change


	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/bootstrap.css" media="screen, projection" />

I think the path is bad???

Thanks you for your responses

Hi,

Whenever I call the carousel widget or the typehead widget, I get this error on my firebug.




$("body").on is not a function



Then it points me to line 152 of bootstrap-carousel.js




$('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {



Anyone have experienced the same?

Make sure that you have transitions enabled.

Hi Chris,

Thanks for the reply. I’ve been trying to make sure of it but I don’t know how. Could you give me a hint of where I can set it please? Thanks a lot for the help. Wonderful extension btw :D

I’m wondering Chris, whether you have had any ideas on how to solve my problem when using BootActiveForm with tabular input (see above)?

Thanks

If you have ‘transitions’ set to false in your component config, then remove that line (they are enabled by default).

Hi again,

I just checked and I don’t have that line anywhere in my component/config.