0

I am looking to use the Jquery Validate combined with Tooltipster in a similar way to the example provided by Sparky on Feb 7th '13: How to display messages from jQuery Validate plugin inside of Tooltipster tooltips?

The difference being that the validation method is via a script function and not a form submit. I also want to attach the tooltips to a class instead of the whole form inputs. Once validation is complete the function calls another function.

It works but shows the following warning:

Non-standard document.all property was used. Use W3C standard document.getElementById() instead.

which I believe document.all is deprecated and not existent in future browser versions. Yet I don't understand why my code is showing the warning! I have eliminated all other possibilities of the cause withing my code. So I think its either something I am not seeing or the Tooltips + Validation combined libraries which is causing the warning.

Here is my JS code:

// initialize tooltipster on text input elements
    $('.valid1').tooltipster({
        trigger: 'custom',
        onlyOne: false,
        position: 'right'
    });

    // initialize validate plugin on the form
    var validator = $('#propCreate').validate({
    onsubmit: false,
        errorPlacement: function (error, element) {
            $(element).tooltipster('update', $(error).text());
            $(element).tooltipster('show');
        },
        success: function (label, element) {
            $(element).tooltipster('hide');
        },
        rules: {

            pkg: { required: true },
            TCaccept: { required: true }

        },
        messages: {
            TCaccept: "Please check acceptance of our terms.",
            pkg: "Please select suitable package."
        },
        submitHandler: function (form) { 

        }

    });
//Validation
// this is to validate terms checkbox & Pkg
$("#btnNext").click(function () {
    if (validator.form()) {
        btnNextContinued()
    }
});

Does anybody have a fix/workaround for this or can show me where I am going wrong?

UPDATE : Following great observation by Sparky and his helpful comments - A bug in Firebug was the cause of a false positive warning. Tooltipster with Validate radio's and checkbox validation without a form submit works fine at this time.

Community
  • 1
  • 1
Martin Sansone - MiOEE
  • 4,281
  • 1
  • 29
  • 31
  • I'm not presently in a place where I can setup a jsFiddle for you. However, you may want to consider using `$('#propCreate').valid()` instead of `validator.form()` to programmatically test your form. – Sparky Aug 09 '13 at 23:58
  • I guess my point is that you don't need to store `.validate()` within a variable since it only should be called once anyhow. – Sparky Aug 10 '13 at 00:00
  • Thanks Sparky, just saw that in the multipart example in the site documentation. Updated my code as you suggest. It does work, but the warning in FF identifies future problem for new browsers which drop the "document.all" - expecting documentById instead. I'd prefer to solve the warning than forget about it and then have production code break at a future point with IE11 etc. – Martin Sansone - MiOEE Aug 10 '13 at 00:04
  • I understand. I just can't help you until maybe tomorrow. Meanwhile, please construct a jsFiddle demo of your problem. – Sparky Aug 10 '13 at 00:09
  • No rush... tomorrow would be great. Forked fiddle = http://jsfiddle.net/4wXBG/ My dev project is in Vis Studio, separate js file holding script linked to page, along with required libraries. – Martin Sansone - MiOEE Aug 10 '13 at 00:18
  • I pulled up both my original jsFiddle and your new jsFiddle. I'm using Firefox and not seeing the warning in either of these. Can you describe what actions need to be taken to make this warning appear? – Sparky Aug 10 '13 at 13:36
  • 1
    Have you tried updating to jQuery 1.9.1, jQuery Validate 1.11.1 and the latest version of Tooltipster? Otherwise, I'm not seeing where your code could have any issues. Although I never saw the warnings, this modified version is how I would do it and appears fine to me: http://jsfiddle.net/4wXBG/3/ – Sparky Aug 10 '13 at 13:48
  • Thanks Sparky for your help. Firefox only shows the warning in firebug on the development site when adding validation/tooltipster into the .NET4 site. I shall check jQuery 1.9.1 don't cause problems with existing code first and then try it. Then I shall report back in here :) – Martin Sansone - MiOEE Aug 10 '13 at 15:58
  • 1
    Is your Firebug up to date? [I was reading about this _"Non-standard document.all property"_ warning as part of a Firebug bug and nothing more.](http://code.google.com/p/fbug/issues/detail?id=6352) The more I look into this, the more it seems like a non-issue. – Sparky Aug 11 '13 at 16:31
  • Thanks Sparky for sharing the info on the Firebug bug !!! You are spot on. Its reassuring for newish programmers like myself to have experienced hands in Stackoverflow pointing the way. Also moved up to 1.9.1 with so far a day of teething problems solved. – Martin Sansone - MiOEE Aug 14 '13 at 21:33
  • Posted as an answer below so you can "close out" this question. Thanks. – Sparky Aug 14 '13 at 22:12

1 Answers1

1

I'm not seeing the reported Non-standard document.all property warning message in any of the demos.

Is your Firebug up to date? I was reading about this "Non-standard document.all property" warning as part of a Firebug bug and nothing more.

The more I look into this, the more it seems like a non-issue.

Sparky
  • 98,165
  • 25
  • 199
  • 285