Yeah, you're going to have to write some custom logic here; you should extend the class. The validate() method runs the validators on every input and shows their errors as appropriate. You want a method that checks every input but doesn't do this and instead provides some other way to read if the form is valid.
If you look at Form.Validator.Inline here: https://github.com/mootools/mootools-more/blob/master/Source/Forms/Form.Validator.Inline.js#L49 You'll see that it's adding it's own onElementValidate method that shows the errors when a field is tested. This class provides options for showing and hiding the actual elements of advice: https://github.com/mootools/mootools-more/blob/master/Source/Forms/Form.Validator.Inline.js#L28 So you could maybe overwrite these to check a flag and not show the messages if that flag is true... Sorry, it's not trivial, but your use case wasn't one we considered when we authored this stuff. On Fri, May 20, 2011 at 2:29 AM, hamburger <[email protected]> wrote: > good idea > but it semms not to work correctly. > http://jsfiddle.net/8hrmc/1/ > > On 19 Mai, 18:01, Aaron Newton <[email protected]> wrote: > > Actually, thinking about this, yeah, there's gonna be a loop. > > onElementValidate is fired whenever an inputs validators are applied, > > whether it's valid or not. So when you call myForm.validate() inside > that, > > it's just going to go validate that input again and fire your event > handler > > again and repeat. > > > > You'll have to set a conditional flag for when it's YOU doing the > validating > > vs the user's action. Something like: > > > > var iAmValidating = false; > > > > myValidator.addEvent('onElementValidate', function(){ > > if (!IAmValidating) { > > iAmValidating = true; > > if (myValidator.validate()) ... > > iAmValidating = false; > > } > > > > }); > > > > A little clunky I realize. > > > > On Thu, May 19, 2011 at 2:53 AM, Arian Stolwijk <[email protected]> wrote: > > > isn't onElementValidate only fired when the form is actually valid. > > > > > On Thu, May 19, 2011 at 11:16 AM, hamburger <[email protected]> wrote: > > > > >> thx Aaron, > > >> but how to grab the whole form elements. The function do not give > > >> them. > > > > >> onElementValidate: function(passed,element,validator,denotes ) { > > > > >> if ( myForm.validate() ){ console.log("something wrong")}; > > > > >> }, > > > > >> gives the error to much recursion >
