4683 Posts in 1048 Topics by 664 members
Jump to:If this is your first visit, you will need to register before you can post. However, you can browse all messages below.
| Page: 1 | go to end | Reply | |
| Author | Topic: Option to leave out javascript validation | 1704 views |

10 October 2007 at 12:53am
Currently there doesn't seem to be a way to leave out javascript validation without hacking into the validator.php file, not a problem for me but not so good for upgrading.
Doing on Requirements::clear(..) doesn't help, as the js will always be included when using 'new requiredfield'.

10 October 2007 at 5:53am
the trick is to clear requirements as close to rendering as possible:
in your case of form-validation, this would be YourCustomFormClass->forTemplate()
but you're right, there should be a switch to disable client-side validation...

28 April 2008 at 12:41pm
dio5, did you sort this out and get Requirements::clear() to work correctly?

15 May 2008 at 3:39pm
Perhaps we should add a couple of useXXValidation() methods on the form, to turn this on / off?
If we did that, the best thing would be to have a FormField::includeJavascriptValidation() method that was called on each Field as part of the form rendering, if javascript validation was selected. It would be a bit of a refactoring, but it would put the responsibility for deciding whether to include javascript validation in the hands of the Form object, which is more appropriate than in the individual form fields.
If we can make a patch for this on trunk, then Dio5 / Blackdog can apply it to their own branches before the next release.
Last edited: 15 May 2008 at 3:39pm

22 May 2008 at 10:14am
Dio5, I never could get the clear() to work even if I targeted the individual files.

23 May 2008 at 7:27am
Sam, that sounds like a good idea.
I managed to work around this with subclassing RequiredFields and returning empty javascriptvalidation functions. - i e overriding those functions in Validator that make the js validation with a blank method.

23 May 2008 at 3:43pm
W/regards Sam's comment, I'd be particularly interested in the ability to override any SS generated javascript with my own.
For example, I use jQuery, so it totally sucks to have prototype imported and used to validate forms when there is an excellent jQuery Validitor plugin that is very easy to template and would add very little overhead to my existing pages. If the hooks were available, devs could produce jQuery/Mootools/YUI ports to perform these common tasks.
If someone is already doing this, or there is a workable solution already, please let me know. Otherwise I'm interesting in helping produce such a framework if someone wants to point me in the right direction.
Cheers!
| 1704 views | |||
| go to top | Reply |