function addnewForm1() {
    // getting the prototype1
    // the prototype1 is the form itself, plain html
    var prototype1 = $collectionHolder1.data('prototype1');
    // get the index
    // this is the index we set when the document was ready, look above for more info
    var index = $collectionHolder1.data('index');
    // create the form
    var newForm1 = prototype1;
    // replace the __name__ string in the html using a regular expression with the index value
    newForm1 = newForm1.replace(/__name__/g, index);
    // incrementing the index data and setting it again to the collectionHolder
    $collectionHolder1.data('index', index+1);
    // create the panel
    // this is the panel that will be appending to the collectionHolder
    var $panel1 = $('<div class="panel panel-warning"><div class="panel-heading"></div></div>');
    // create the panel-body and append the form to it
    var $panel1Body = $('<div class="panel-body"></div>').append(newForm1);
    // append the body to the panel
    $panel1.append($panel1Body);
    // append the removebutton to the new panel
    $addRemoveButton1($panel1);
    // append the panel to the addNewItem
    // we are doing it this way to that the link is always at the bottom of the collectionHolder
    $addNewItem1.before($panel1);
}
/*
 * creates a new form and appends it to the collectionHolder
 */
creates a new form and appends it to the collectionHolder
creates a new form and appends it to the collectionHolder
function addnewForm1() {
    var prototype1 = $collectionHolder1.data('prototype1');
    var index = $collectionHolder1.data('index');
    var newForm1 = prototype1;
    newForm1 = newForm1.replace(/__name__/g, index);
    $collectionHolder1.data('index', index+1);
    var $panel1 = $('<div class="panel panel-warning"><div class="panel-heading"></div></div>');
    -body and append the form to it
    var $panel1Body = $('<div class="panel-body"></div>').append(newForm1);
    $panel1.append($panel1Body);
    $addRemoveButton1($panel1);
    $addNewItem1.before($panel1);
}
function addnewForm1 ( ) { var prototype1 = $collectionHolder1 . data ( 'prototype1' ) ; var index = $collectionHolder1 . data ( 'index' ) ; var newForm1 = prototype1 ; newForm1 = newForm1 . replace ( / __name__ / g , index ) ; $collectionHolder1 . data ( 'index' , index + 1 ) ; var $panel1 = $ ( '<div class="panel panel-warning"><div class="panel-heading"></div></div>' ) ; var $panel1Body = $ ( '<div class="panel-body"></div>' ) . append ( newForm1 ) ; $panel1 . append ( $panel1Body ) ; $addRemoveButton1 ( $panel1 ) ; $addNewItem1 . before ( $panel1 ) ; }
creates a new form and appends it to the collectionHolder
creates a new form and appends it to the collectionHolder
// getting the prototype1 // the prototype1 is the form itself, plain html // get the index // this is the index we set when the document was ready, look above for more info // create the form // replace the __name__ string in the html using a regular expression with the index value // incrementing the index data and setting it again to the collectionHolder // create the panel // this is the panel that will be appending to the collectionHolder // create the panel-body and append the form to it // append the body to the panel // append the removebutton to the new panel // append the panel to the addNewItem // we are doing it this way to that the link is always at the bottom of the collectionHolder