MonoRail: how to remove prototype validation?
I'm maintaining an application with monorail, and we decided to change the validation method for the Jquery one. So far so good, but... the problem i'm having is that i can't get rid of the reference to the previous validation method which is prototype.
Thing is that a Javascript is always placed after the tag forms i create.
<script type="text/javascript">
if (!window.prototypeValidators) prototypeValidators = $A([]);
var validator = new Validation('form1', {onSubmit:true, focusOnError:true, stopOnFirst:false, immediate:true, useTitles:true});
prototypeValidators['form1'] = validator;
</script>
I haven't been abl开发者_如何学Ce to find clear documentation about monorail validation methods.
And this turns to produce some errors on the browser like so:
$A is not defined
[Break On This Error] if (!window.prototypeValidators) prototypeValidators = $A([]);
Any help or pointers in the right way for documentation about this or how to remove this kind of validation from monorail, will be greatly appreciated.
Thanks in advance
MetalGeorge
PS. i gotta say i'm fairly new to monorail
You can switch to jQuery generation (default is Prototype as you noted) with the JSGeneratorConfiguration property in the Monorail config. See http://hammett.castleproject.org/?p=238 for reference.
Or you can get rid of form validation generation completely by replacing:
$Form.FormTag("%{action='LoginAction'}")
...
$Form.EndFormTag()
with a regular form tag:
<form method="post" action="$Url.For("%{action='LoginAction'}")">
...
</form>
精彩评论