Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving formFields to options in sheepIt jquery plugin #19

Open
christophediprima opened this issue Apr 11, 2013 · 0 comments
Open

Moving formFields to options in sheepIt jquery plugin #19

christophediprima opened this issue Apr 11, 2013 · 0 comments

Comments

@christophediprima
Copy link

Hi Mariano,

First I would like to thank you for sheepIt. This is a very useful plugin!
Then I would like to submit you a proposal to improve the way it can be used.

I tried to implement jQuery select2 in a sheepIt form using the callback function afterAdd.

// Initialize sheepit fieldsets
$('.sheepit').sheepIt({
separator:'',
afterAdd: function(source, clone) {
clone.extendSelect2s(); // extend select2 apply select2 to all clone children
}
});

Select2 plugin add a additional input with no id, no name and no template attributes but only behaviors that correctly link it to the select2 plugin. However sheepit fails executing if it finds these additional inputs with no templating attributes.

I propose to make formFields selector an option in stead of a simple var in the plugin so we can do this :

// Initialize sheepit fieldsets
$('.sheepit').sheepIt({
formFields: "input:not(.select2-input), checkbox, select, textarea",
separator:'',
afterAdd: function(source, clone) {
clone.extendSelect2s();
}
});

What do you thing about this?

Cheers,
Christophe Di Prima

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant