Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba

block behaviour.js but still have Behaviour.register({ })


Go to End
Reply


3 Posts   2129 Views

Avatar
snaip

Community Member, 180 Posts

18 December 2009 at 11:22pm

i blocked this files

Requirements::block('jsparty/prototype.js');
Requirements::block('jsparty/behaviour.js');
Requirements::block("jsparty/scriptaculous.js");
Requirements::block("jsparty/loader.js");
Requirements::block('jsparty/prototype_improvements.js');
Requirements::block('sapphire/javascript/Validator.js');
Requirements::block('sapphire/javascript/lang/en_US.js');

but still have Behaviour.register({ for form

<script type="text/javascript">//<![CDATA[
Behaviour.register({
"#Form_formularz_en": {
validateDate: function(fieldName) {
var el = _CURRENT_FORM.elements[fieldName];
var value = $F(el);

if(value && value.length > 0 && !value.match(/^[0-9]{1,2}\/[0-9]{1,2}\/[0-90-9]{2,4}$/)) {
validationError(el,"Please enter a valid date format (DD/MM/YYYY).","validation",false);
return false;
}
return true;
}
}
});

Avatar
snaip

Community Member, 180 Posts

4 January 2010 at 12:12am

????

Avatar
kuenkuen82

Community Member, 41 Posts

29 June 2010 at 11:12pm

Edited: 06/07/2010 8:18pm

I'm using 2.4 and I've added

Requirements::block("sapphire/thirdparty/prototype/prototype.js");	

in function init()

you could also remove the validation:

lidator::set_javascript_validation_handler('none');

http://doc.silverstripe.org/Validator

Also look at the following Docuemnt