app/assets/javascripts/sufia/multiForm.js in sufia-4.0.0.rc1 vs app/assets/javascripts/sufia/multiForm.js in sufia-4.0.0.rc2
- old
+ new
@@ -4,11 +4,11 @@
// Create some defaults, extending them with any options that were provided
var settings = $.extend( { }, options);
function addField() {
- count = $(this).closest('.control-group').find('.controls').size();
+ count = $(this).closest('.form-group').find('input').size();
var cloneId = this.id.replace("submit", "clone");
var newId = this.id.replace("submit", "elements");
var cloneElem = $('#'+cloneId).clone();
// change the add button to a remove button
var plusbttn = cloneElem.find('#'+this.id);
@@ -27,10 +27,10 @@
// creator_name
// creator_role
textFields = cloneElem.find('input[type=text]')
$.each(textFields, function(n, tf) {
newName = $(tf).attr('name').replace('[0]', '['+count+']');
- $(tf).attr('name', newName).attr("value", "").attr("required", false)
+ $(tf).attr('name', newName).val('').attr("required", false)
})
if (settings.afterAdd) {
settings.afterAdd(this, cloneElem)
}