Top Quality Products

JQuery AdDelFields

4.8
Expert ScoreRead review

$3.00

Added to wishlistRemoved from wishlist 0
Add to compare

55 sales

LIVE PREVIEW

JQuery AdDelFields

Review: JQuery AdDelFields Plugin

Introduction

JQuery AdDelFields is a powerful plugin that enables you to easily duplicate or delete fields within a form. This plugin is particularly useful for situations where you need to add or remove form fields dynamically, such as when building a shopping cart or a registration form.

What Does it Do?

To use this plugin, you need to insert your form inside a div with a specific class, for example, "contenitore_input". Then, you need to close this div with a specific id, for example, "contenitore_generale". You also need to assign a reference attribute to each field you want to duplicate, such as an "alt" attribute. This attribute will be used as a fixed part of the field’s name and id.

For example, if you have a field <input alt="nome">, the plugin will convert it to <input alt="nome" name="nome_1" id="nome_1"> when you click the "Add" button. This allows the page receiving the request to obtain the value of a specific input or differentiate between them.

Advanced Features

JQuery AdDelFields offers several advanced features that make it even more powerful:

  1. Validation: The plugin comes with a built-in validation system that allows you to specify classes to indicate the binding of a field, whether a field must be numeric, contain an email address, or a date in a specific format.
  2. Callback Functions: The plugin provides callback functions that allow you to perform custom actions after the addition or removal of fields.
  3. Duplicate Attributes: The plugin also duplicates all the attributes of duplicate fields for consistency.

Pros and Cons

Pros:

  • Easy to use and integrate with your forms
  • Powerful and flexible features, such as validation and callback functions
  • High rating of 4.8/5

Cons:

  • May require some configuration and customization to suit your specific needs

Conclusion

JQuery AdDelFields is a fantastic plugin that can greatly simplify the process of managing dynamic form fields. Its ease of use, powerful features, and high rating make it a great choice for developers and non-developers alike. While it may require some configuration, the benefits it provides far outweigh the drawbacks. If you’re looking for a reliable and efficient way to manage form fields, JQuery AdDelFields is definitely worth considering.

User Reviews

0.0 out of 5
0
0
0
0
0
Write a review

There are no reviews yet.

Be the first to review “JQuery AdDelFields”

Your email address will not be published. Required fields are marked *

Introduction

The jQuery AdDelFields plugin is a powerful tool for dynamically adding fields to a form. It allows you to dynamically generate fields, such as input text fields, checkboxes, or dropdowns, based on user input or other conditions. This plugin is particularly useful when you need to generate complex forms that require dynamic field creation. In this tutorial, we will explore how to use the jQuery AdDelFields plugin to create a dynamic form with dynamically added fields.

Getting Started

To get started, you need to include the jQuery AdDelFields plugin in your HTML file. You can do this by adding the following line of code inside your HTML file's <head> section:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery.addfields@1.0.5/dist/jquery.addfields.min.js"></script>

Basic Usage

The AdDelFields plugin works by using the addFields method to generate the fields. This method takes several optional parameters, including:

  • fieldType: The type of field to generate (e.g. "text", "checkbox", "select").
  • label: The label for the field.
  • id: The ID for the field.
  • placeholder: The placeholder text for the field (for text fields only).

Here is an example of how to use the addFields method to generate a simple text field:

$(document).ready(function() {
  $('#add-button').click(function() {
    $('#my-form').addFields({
      fieldType: 'text',
      label: 'New Field',
      id: 'new-field-' + ($('input[type="text"]').length + 1)
    });
  });
});

In this example, we are generating a new text field with the label "New Field" and an ID that increments with each new field generated. The field is appended to a form with the ID my-form. We are also using a button with the ID add-button to trigger the generation of the new field.

Configuring Fields

The AdDelFields plugin provides several options to customize the fields. For example, you can use the options parameter to specify options for the field. Here is an example of how to use the options parameter to generate a dropdown field with options:

$(document).ready(function() {
  $('#add-button').click(function() {
    $('#my-form').addFields({
      fieldType: 'select',
      label: 'New Field',
      id: 'new-field-' + ($('select').length + 1),
      options: [
        {text: 'Option 1', value: '1'},
        {text: 'Option 2', value: '2'},
        {text: 'Option 3', value: '3'}
      ]
    });
  });
});

In this example, we are generating a new dropdown field with three options. The options parameter is an array of objects, where each object contains the text and value properties for each option.

Removing Fields

The AdDelFields plugin also provides an removeFields method to remove fields from the form. This method takes the ID of the field to remove as its parameter. Here is an example of how to use the removeFields method to remove a field:

$(document).ready(function() {
  $('#remove-button').click(function() {
    $('#my-form').removeFields($('#my-form input[type="text"]:last').attr('id'));
  });
});

In this example, we are removing the last text field in the form. We are using the attr method to get the ID of the last text field, and then passing that ID to the removeFields method.

Conclusion

In this tutorial, we have explored how to use the jQuery AdDelFields plugin to create a dynamic form with dynamically added fields. We have covered how to use the addFields method to generate fields, configure fields using the options parameter, and remove fields using the removeFields method. With this plugin, you can create complex forms that require dynamic field creation.

Here is an example of how to configure jQuery AdDelFields:

header

{
  "delimiter": ";",
  "escapeChar": "\",
  "ignoreCase": true
}

fields

{
  "fields": [
    {
      "name": "name",
      "label": "Name",
      "type": "text"
    },
    {
      "name": "email",
      "label": "Email",
      "type": "email"
    },
    {
      "name": "phone",
      "label": "Phone",
      "type": "phone"
    }
  ]
}

validator

{
  "validator": {
    "name": {
      "required": true,
      "minLength": 2,
      "maxLength": 50
    },
    "email": {
      "required": true,
      "email": true
    },
    "phone": {
      "required": true,
      "phone": true
    }
  }
}

autocomplete

{
  "autocomplete": {
    "enabled": true,
    "source": "/autocomplete",
    "minLength": 2
  }
}

sortable

{
  "sortable": true
}

filterable

{
  "filterable": {
    "enabled": true,
    "filter": "name"
  }
}

Here are the key features of the jQuery AdDelFields plugin:

Basic Features

  1. Duplicates or deletes fields within a form.
  2. Requires a div container with a specific class (e.g. "contenitore_input") to be inserted.
  3. The div container should be closed within another div with a specific id (e.g. "contenitore_generale").
  4. Each field to be duplicated must have a reference attribute (e.g. alt="nome") which will be used to generate the fixed part of the field's NAME and ID.

Advanced Features

  1. Validation: Supports validation of added fields with the following classes:
    • bind-field: indicates the binding of a field
    • numeric: indicates a field must be numeric
    • email: indicates a field must contain an e-mail
    • date: indicates a field must contain a date in the format dd/mm/yyyy
  2. Callback functions: Available after the addition and removal of fields.
  3. Attribute duplication: Automatically duplicates all attributes of duplicate fields for consistency.

Other

  • Assigns a unique NAME and ID to each duplicated field.
  • Allows differentiation between fields by assigning a unique NAME and ID to each field.
Shop.Vyeron.com
Logo
Compare items
  • Total (0)
Compare
0