21305 Posts in 5736 Topics by 2603 members
| Go to End | ||
| Author | Topic: | 2238 Views |
-
Re: Validation on forms using JS

8 July 2009 at 3:39pm
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.
-
Re: Validation on forms using JS

8 July 2009 at 8:00pm
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?
-
Re: Validation on forms using JS

8 July 2009 at 9:16pm
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.
-
Re: Validation on forms using JS

8 July 2009 at 9:27pm
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
-
Re: Validation on forms using JS

8 July 2009 at 9:31pm
Hi!
What about the changes in the JS-File you did?
| 2238 Views | ||
| Go to Top |


