You can do a Requirements::block(...) to prevent a file from being loaded, then add your file - you'll have to copy whole file though.
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
- Previous 10 entries
- 1
- Page 22(current)
so should I block the JS file that is being called in sapphire/javascript/?
surely there is another way to change this error handling in javascript?
Try blocking the script, then in setting up Requirements re-add script and then add your own script with a custom 'validationError' function which could change functionality. If you manually add them I believe it keeps the correct order, and they are 'global' functions so latest will override previous.
The current function appends a span with class "message required" to the parent element of the field with the "<field-name> is required" message. Instead change the function to change the field to, e.g. a red border (or the parent element).
You could do this with CSS selector on the span with "message required" :prev type selector (and set the span itself to display: none) but this probably doesn't work on many browsers.
You may need to block the default CSS and add your own/override styles where applicable too.
Thanks guys, I got it solved.
I had to do the block and then include my file as you guys mentioned.
However my JS file had to have the same content as the sapphire file and then I could override the function.
here is the code that worked:
Requirements::block('sapphire/javascript/Validator.js');
Requirements::javascript('mysite/javascript/ValidatorExtension.js');
thanks
Elemental
http://www.elemental.co.za
Hi!
What about the changes in the JS-File you did?
- Previous 10 entries
- 1
- Page 22(current)