ajaxian
(Dorioajax)
March 11, 2012, 7:37am
1
Hi all,
I get with my Yii application a contact form. Perfect !
I configure it in a very light fashion:
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'contact-form',
'enableAjaxValidation'=>false,
'enableClientValidation'=>false
));
?>
Or maybe it is introduced via the widget CCaptcha.
However I see in my <head> part that jquery was introduced via assets.
And I don’t want that.
Is there a way (I can’t see that in Api doc) to indicate that jQuery has not to be loaded ?
Thanks
mdomba
(Maurizio Domba Cerin)
March 11, 2012, 6:37pm
2
For this you can use the scriptMap - http://www.yiiframew …criptMap-detail
Search a bit on the forum for some examples…
ajaxian
(Dorioajax)
March 11, 2012, 6:44pm
3
Thanks but i do not understand however.
Why CCaptcha or CActiveForm includes jquery library whereas there is no need in my case ?
phtamas
(Phtamas)
March 11, 2012, 7:32pm
4
If you don’t need the built-in javascript functionality of CActiveForm then you probably don’t need CActiveForm at all. Form helper methods of CHtml would do the job as well.
ajaxian
(Dorioajax)
March 12, 2012, 6:48am
5
I don know why
To be more precise:
The CActiveForm comes in the Yii built in (contact). It is clearly attached to a model ContactForm
And I don’t see the need of javascript when I do not use ajax or other things.
For me CActiveForm is used whenever there is no active record in database.
That is the case with the contact.
and the problem comes from
<?php $this->widget('CCaptcha'); ?>
when I delete this line, there is no jquery library used.
It seems that CCaptcha uses Ajax in is stuff when a button is inserted to refreseh (via Ajax) the code.
if I write
<?php $this->widget('CCaptcha',array('showRefreshButton'=>false)); ?>
then I specify that no ajax button is needed and then there is no problem.