elclanrs / jq-idealforms-old

The ultimate framework for building and validating responsive HTML5 forms.
665 stars 95 forks source link

Methods not working after initializaiton #95

Closed dcampbell85 closed 11 years ago

dcampbell85 commented 11 years ago

I try to do something as simple as next tab and i get an error. "Uncaught TypeError: Object [object Object] has no method 'nextTab' "

Here is the code:

var options = {
    disableCustom: 'radiocheck',
    inputs: {
        'FirstName': {
            filters: 'name required'
        },
        'Middle': {
            filters: 'max',
            data: {
                max: 1
            }
        },
        'LastName': {
            filters: 'name required'
        }
    }
};

var $idealform = $('#Contract').idealforms(options);

$('#next').click(function () {
    $idealform.nextTab().focusFirst();
});
$('#prev').click(function () {
    $idealform.prevTab();
});
dcampbell85 commented 11 years ago

Nevermind I found a solution. To append ".data('idealforms')" to my idealforms intialization.

I had just updated my idealforms js and didn't realized this got added. What does .data('idealforms') actually do?

elclanrs commented 11 years ago

The data part is based on the jQuery boilerplate; it attaches the methods to the object without polluting the global jQuery scope.