jQuery plugin to add multiple fields on the fly on web page - Version 2
This plugin is really easy to implement with cool options like:
- linkText
- linkClass
- enableRemove
- removeLinkText
- removeLinkClass
- confirmOnRemove
- confirmationMsgOnRemove
- beforeAddEventCallback (new)
- addEventCallback
- removeEventCallback
- maxItemsAllowedToAdd
- maxItemReachedCallback
- data (new)
Default options
linkText: 'Add more',
linkClass: 'addMoreFields',
enableRemove: true,
removeLinkText: 'Remove',
removeLinkClass: 'removeFields',
confirmOnRemove: true,
confirmationMsgOnRemove: 'Are you sure you wish to remove selected field(s)?',
beforeAddEventCallback: null,
addEventCallback: null,
removeEventCallback: null,
maxItemsAllowedToAdd: null,
maxItemReachedCallback: null,
data: []
Examples:
Sample of default settings
Code Example:
$(document).ready(function() {
$("#itemDetails").EnableMultiField();
});
Back to top
Sample of edit mode(with selected data by default)
Code example:
$("#itemDetailsEdit").EnableMultiField({
data:[{
itemName : "Test", // All these properties needed to be set as "recname" attribute of each input you want to set value to
itemGaylords : "2",
itemDesc : "Test Desc",
itemDrpPackagingTypes : "4"
},
{
itemName : "Test 2",
itemGaylords : "3",
itemDesc : "Test Desc 3",
itemDrpPackagingTypes : "5"
}
,
{
itemName : "Test 3",
itemGaylords : "4",
itemDesc : "Test Desc 4",
itemDrpPackagingTypes : "12"
}]
});
});
Back to top
Sample of event binding to new generated fields (It attaches calendar
to date fields dynamically)
Code example:
$("#itemDetailsEvent").EnableMultiField({
addEventCallback : function(newElem, clonnedFrom){
newElem.find("input.date").datepicker({
showOn: "both",
buttonImage: "images/calendar.gif",
buttonImageOnly: true
});
}
});
Back to top