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

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


Reply

3 Posts   1939 Views

Avatar
snaip

18 December 2009 at 11:22pm Community Member, 180 Posts

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

4 January 2010 at 12:12am Community Member, 180 Posts

????

Avatar
kuenkuen82

29 June 2010 at 11:12pm (Last edited: 6 July 2010 8:18pm), Community Member, 41 Posts

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 [url=http://doc.silverstripe.org/Validator/]Docuemnt[/url]