Jump to:

5453 Posts in 1674 Topics by 1198 members

Customising the CMS

SilverStripe Forums » Customising the CMS » block behaviour.js but still have Behaviour.register({ })

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

Page: 1
Go to End
Author Topic: 1861 Views
  • snaip
    Avatar
    Community Member
    180 Posts

    block behaviour.js but still have Behaviour.register({ }) Link to this post

    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;
          }
       }
    });

  • snaip
    Avatar
    Community Member
    180 Posts
  • kuenkuen82
    Avatar
    Community Member
    41 Posts

    Re: block behaviour.js but still have Behaviour.register({ }) Link to this post

    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

    1861 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.