This is a live demo page. Go back to the main article
(Last updated : 18th June 2011)

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:

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();
});
        
Item Options

Item :

# of Units :

Description :

Packaging Type :


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"
  }]
 });
});
  
Item Options

Item :

# of Units :

Description :

Packaging Type :


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
  });
 }
});
  
Item Options

Item :

Date of shipping :

# of Units :

Description :

Packaging Type :


Back to top

This is a live demo page. Go back to the main article

© Vipul Limbachiya