mdelrosso / sheepit

SheepIt! Form Cloning plugin for Jquery
http://www.mdelrosso.com/sheepit/
MIT License
68 stars 44 forks source link

Remove last break when only one #30

Open lechuky opened 10 years ago

lechuky commented 10 years ago

Hi,

Remove last when is only one breaks. If there is only one form and minFormsCount is set to 1 you can delete it anyhow. The problem is the count of de forms is 29 show 29 > 1 it let delete de form.

lechuky commented 10 years ago

Have found de solution:

In the funcion count check if x is numeric: if (jQuery.isNumeric(x) && forms[x] ) {

function count() { if (forms.length > 0) { var count = 0; var x = []; for (x in forms) { console.log("La X es: "+x); if (jQuery.isNumeric(x) && forms[x] ) { count++; } } console.log("Count: "+count); return count; } else { return 0; } }