vivin / regula

Regula: An annotation-based form-validation framework in Javascript
126 stars 24 forks source link

IE9 Object doesn't support property or method 'setCustomValidity' #61

Closed rvashis closed 10 years ago

rvashis commented 10 years ago

Running into this issue in IE8/9.

It points to my line: var formValidationResults = regula.validate();

I saw a prior issue, but it seemed to be caused by using an older version, has this been resolved yet?

vivin commented 10 years ago

Are you trying to use HTML5 validation messages? Unfortunately Regula is not an HTML5 shim. So if you're trying to display custom validation messages, you will need to use an HTML5 shim. AFAIK IE 8/9 do not support HTML5 in any fashion.

rvashis commented 10 years ago

I am not trying to use 'required' or 'pattern' or any HTML5 validations. They do not appear in my HTML markup in any place. All I want to do is iterate through each element in formValidationResults and then add a class like so:

for(var i = 0; i < formValidationResults.length; i++) { var formValidationResult = formValidationResults[i]; var jQuerySelector = "#"+formValidationResult.failingElements[0].id $(jQuerySelector).addClass('requiredField'); }

so if I can get the regula.validate() line to fire in IE8/9 I should be set.

vivin commented 10 years ago

Ah my mistake! So sorry! So in the latest version HTML5 validation-support is enabled by default. You can disable it by doing:

regula.init({
    enableHTML5Validation: false
});

Do this before you bind or call validate. This will disable HTML5 validation and so you should be able to get this to work in IE 8/9.

This would have been mentioned in the documentation if I had finished it :D Unfortunately with work I have been very busy. I hope I can get back to finishing the documentation soon!

vivin commented 10 years ago

Did that fix your issue @rvashis?

rvashis commented 10 years ago

Unfortunately I won't be able to try and implement this solution in my codebase, so I can't say for sure. I have other scripts using Regula that I don't maintain, so I can't turn off their HTML5 validation.

vivin commented 10 years ago

Well, as long as you are not using any HTML5 validation attributes, you should simply be able to call init to disable HTML5, before calling regula.validate.

On Thu, Mar 20, 2014 at 9:39 AM, rvashis notifications@github.com wrote:

Unfortunately I won't be able to try and implement this solution in my codebase, so I can't say for sure. I have other scripts using Regula that I don't maintain, so I can't turn off their HTML5 validation.

Reply to this email directly or view it on GitHubhttps://github.com/vivin/regula/issues/61#issuecomment-38190282 .

Ruin untold; And thine own sadness, Sing in the grass, When eve has forgot, that no more hear common things that gleam and pass; But seek alone to lip, sad Rose of love and ruin untold; And thine own mother Can know it as I know More than another What makes your own sadness, Set in her eyes.

$s="01:11:02:11:01:11:02:13:01:11:01:11:01:13:02:12:01:13:01:11: 04:11:06:12:04:11:01:12:01:13:02:12:01:14:01:13:01:11:03:12: 01:11:04:12:02:11:01:11:01:13:02:11:03:11:06:11:01:11:05:12: 02:11:01:11:01:13:02:11:02:12:01:12:04:11:06:12:01:11:04:12: 04:11:01:12:03:12:01:12:01:11:01:12:01:12:02:11:01:11:01:13: 02:11:01:02:11:01:12:02"; @a=split(/:/,$s);$j="";foreach$c(@a) {@n=split(//,$c);$j.=$n[0]x$n[1];} for($i=0;$i<$j=~y///c;$i+=8){print chr(unpack("N",pack("B32",substr("0"x32 .substr($j,$i,8),-32))));}