1500 Posts in 413 Topics by 448 members
Blog Module
SilverStripe Forums » Blog Module » Page Comment Interface - Disabling Javascript?
Discuss the Blog Module.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
| Go to End | Next > | |
| Author | Topic: | 1632 Views |
-
Page Comment Interface - Disabling Javascript?

11 March 2010 at 8:50am Last edited: 11 March 2010 8:51am
Hi,
I have a custom jQuery dropdown menu I use on my blog module. This works fine on the BlogHolder, but on the BlogEntry template, No matter WHAT I do, I CANNOT keep these SIX javascripts from attaching themselves:
prototype.js
behaviour.js
prototype_improvements.js
i18n.js
en_US.js
Validator.jsI have commented the Requirements lines in PageCommentInterface.php, in addition to setting use_ajax_commenting to false, in PageCommentInterface.php as well as in _config.php, but they STILL get attached to the page! I HAVE to remove these as the code conflicts with elements/functionality already in my template.
Does anyone know how to remove this, or is there a jQuery Page Comment Interface available?
I'm running SS 2.3.6.
Thanks,
Garrett -
Re: Page Comment Interface - Disabling Javascript?

11 March 2010 at 11:36am
Tried using Requirements::block()?
simon_w has rewritten page comments to use jquery - http://open.silverstripe.org/ticket/4814. Not been merged into core just yet.
-
Re: Page Comment Interface - Disabling Javascript?

11 March 2010 at 11:48am Last edited: 11 March 2010 11:49am
Hey @willr.
Yeah, I did try using that-- it works and removes the scripts,-- but it still writes a bunch of JS to the page even without these script attachments. Just loose in-page script at the bottom:
<script type="text/javascript">//<![CDATA[
Behaviour.register({
'#PageCommentInterface_Form_PostCommentForm': {
validate : function(fromAnOnBlur) {
initialiseForm(this, fromAnOnBlur);
var error = hasHadFormError();
if(!error && fromAnOnBlur) clearErrorMessage(fromAnOnBlur);
return !error;
},
onsubmit : function() {
if(typeof this.bypassValidation == 'undefined' || !this.bypassValidation) return this.validate();
}
},
'#PageCommentInterface_Form_PostCommentForm input' : {
initialise: function() {
if(!this.old_onblur) this.old_onblur = function() { return true; }
if(!this.old_onfocus) this.old_onfocus = function() { return true; }
},
onblur : function() {
if(this.old_onblur()) {
// Don't perform instant validation for CalendarDateField fields; it creates usability wierdness.
if(this.parentNode.className.indexOf('calendardate') == -1 || this.value) {
return $('PageCommentInterface_Form_PostCommentForm').validate(this);
} else {
return true;
}
}
}
},
'#PageCommentInterface_Form_PostCommentForm select' : {
initialise: function() {
if(!this.old_onblur) this.old_onblur = function() { return true; }
},
onblur : function() {
if(this.old_onblur()) {
return $('PageCommentInterface_Form_PostCommentForm').validate(this);
}
}
}
});//]]>
Can't figure out where this is coming from.
//Garrett
-
Re: Page Comment Interface - Disabling Javascript?

9 July 2010 at 1:15am
Hey Garrett
i have got the same problem - it does this also with the $SearchForm. Have you figured out how to get this bunch of JS out. It stops allowing me a "slideDown" and "slideUp" event from jquery.
thanks
Tobias
-
Re: Page Comment Interface - Disabling Javascript?

9 July 2010 at 1:41am
No, I never figured it out. I ended up just re-enabling it and then adding some script around my jQuery code to make Prototype ignore it. Wrap all your jQuery calls in this:
;(function($) {
......})(jQuery);
Hope that helps,
Garrett -
Re: Page Comment Interface - Disabling Javascript?

10 July 2010 at 11:53am Last edited: 10 July 2010 8:39pm
Also you can disable the prototype validation. I think that will remove that code
Validator::set_javascript_validation_handler('none');
-
Re: Page Comment Interface - Disabling Javascript?

10 July 2010 at 8:37pm
Great Willr thanks it works perfectly! all your contribution and help here in the forum is really outstanding.. i have used your answers very often already...
tobias
-
Re: Page Comment Interface - Disabling Javascript?

21 November 2010 at 4:14am
How disable prototype for template form?
| 1632 Views | ||
| Go to Top | Next > |



