Buy Now
Sign in

Error gvalidation.js when on IE8

ulimc , January 15 2015
U
ulimc
Hi,
my client has found a problem when using the form with IE8.
The form in IE8 submits without making the checks. All other browsers are ok.

The error fired is this: "Property or method not supported by the object" (gvalidation.js, row 122, char 6)

This is where the debugger stops. --> return $this.val().trim().match(GValidtaion.rules[$rule_parts[0]]);

Any help would be much appreciated.
Thank you.
GreyHead
Hi ulimc,

I have no idea but did look at the code. In my version the line you posted is line 102, line 122 is
  $.fn.show_gvalidate_error = function(rule){
I'm afraid that doesn't help me understand the error though.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
W
walterbz
Hi there, same problem with validation on IE8.
All other browser are ok.
Error:

Message: Property or method not supported by the object
Line: 274
Char: 8
Code: 0
URI: mysite/libraries/cegcore/assets/gplugins/gvalidation/gvalidation.js
Joomla: 3.2.4
Chronoforms5 5.0.9

Thank You
GreyHead
Hi,

Fortunately IE8 only has six months of life left . . .

It looks as though trim() isn't supported until IE9. I found this StackOverFlow answer which has a solution, Putting this Code into a Load JavaScript action in the form On Load event seems to resolve the error.
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
};
}

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
W
walterbz
Great Bob.
Just offered you a beer! ThankYou
Walter
J
jmwlska
Same problem with IE8.

Added the above code to the Load Javascript action. It removed the error and added the red asterisk's to the fields
but it's still possible to submit the form without the required fields in IE8.

Form: http://www.phpoy.fi/index.php/palaute

Juha-Matti
GreyHead
Hi Walter,

You have a JavaScript error on the page from the giosg.com iFrame - if you get that fixed I think that the validation will be OK.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
J
jmwlska
Hi Bob,

I can't see the error. The Giosg Chat is called with this script in the head section of index.php:

<!-- giosg tag -->
<script>
(function(w, t, f) {
var s='script',o='_giosg',h='https://service.giosg.com',e,n;e=t.createElement(s);e.async=1;e.src=h+'/live/';
w[o
  • =w[o]||function(){(w[o]._e=w[o]._e||
  • ).push(arguments)};w[o]._c=f;w[o]._h=h;n=t.getElementsByTagName(s)[0];n.parentNode.insertBefore(e,n);
    })(window,document,2420);
    </script>
    <!-- giosg tag -->

    Is there an error in the script?

    Juha-Matti
    GreyHead
    Hi jmwlska,

    It seems to come and go - I no longer see it in Chrome but get the error again in IE when the form first loads - then it goes again.

    The validation appears to work correctly checking with IE11 in IE8 mode.

    Bob
    ChronoForms technical support
    If you'd like to buy me a coffee or two, thank you very much
    J
    jmwlska
    I removed the giosg script entirely but no luck. So the error must be somewhere else.
    I have an old PC with IE8 and it doesn't require the fields to be filled. I can submit an empty form.

    I dont mind but the client keeps calling me and asking about it. Apparently there's still a lot of IE8 users out there.

    God I hate IE!
    GreyHead
    Hi jmwlska,

    I'd suggest that you add serverside validation - that will work in IE8 and stop false submissions.

    Bob
    ChronoForms technical support
    If you'd like to buy me a coffee or two, thank you very much
    J
    jmwlska
    Hi Bob,

    Server Side Validation did the trick.

    One slight problem. With IE8 the "You did not fill in all the fields" page seems to breakup the template css?
    GreyHead
    Hi Juha-Matti,

    I don't have 'pure' IE8 any more - I checked with IE11 in IE8 mode and that looks OK. I see this message below the form: Nimi ja sähköpostiosoite ovat pakollisia tietoja, jotta voimme olla sinuun tarvittessa yhteydessä.

    Bob
    ChronoForms technical support
    If you'd like to buy me a coffee or two, thank you very much
    J
    jmwlska
    Hi Bob,

    That's okay. I can live with it. Thanks for all the help.
    M
    mnunes
    Today I remembered to test some forms (V5) in IE8 and ran into this problem.
    As it has been mentioned, the problem is that IE8 (and below) doesn't support String.trim()

    If we replace line 274 of /libraries/cegcore/assets/gplugins/gvalidation/gvalidation.js
    by
    return $.trim($(gval.element).val()).match($.gvalidation.rules[$rule_parts[0]]);

    It seems to work fine. No undesired form submission.


    MN