
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@degjs/form-field-appender
Advanced tools
A module for adding and saving an infinite number of form fields.
formFieldAppender is a Javascript module that allows you to add and remove an infinite number of similar form fields to a form.
formFieldAppender is an ES6 module. Consequently, you'll need an ES6 transpiler (Babel is a nice one) as part of your Javascript workflow.
If you're already using NPM for your project, you can install formFieldAppender with the following command:
$ npm install @degjs/form-field-appender
Import formFieldAppender and create a new instance of it.
import formFieldAppender from '@degjs/form-field-appender';
let element = document.querySelector('div');
let instance = formFieldAppender(element);
By default, formFieldAppender will search the supplied element
for an item that matches the itemClass
parameter to use as its blueprint.
However, you can optionally provide either an HTML element or string representation of an HTML element as the item blueprint.
import formFieldAppender from '@degjs/form-field-appender';
let element = document.querySelector('div');
let itemBlueprint = document.createElement('div');
itemBlueprint.classList.add('phone-field__wrapper');
itemBlueprint.insertAdjacentHTML('afterbegin', `
<label for="phone-field">Field</label>
<input class="phone-field" name="phone-field" id="phone-field" type="tel">
`);
let instance = formFieldAppender(element, {
blueprint: itemBlueprint
});
import formFieldAppender from '@degjs/form-field-appender';
let element = document.querySelector('div');
let itemBlueprint = `
<div class="phone-field__wrapper">
<label for="phone-field">Field</label>
<input class="phone-field" name="phone-field" id="phone-field" type="tel">
</div>
`;
let instance = formFieldAppender(element, {
blueprint: itemBlueprint
});
Type: HTMLElement
or string
An HTML element or string representation of an HTML element that will be used as the blueprint for the repeating field.
Default: null
Type: string
The class applied to each appended item.
Default: js-ffa-item
Type: string
The selector for each item's add trigger.
Default: .js-ffa-add-trigger
Type: string
The selector for each item's remove trigger.
Default: .js-ffa-remove-trigger
Type: string
The attribute that contains the pattern that will be used to create each appended item's ID. A token of [[itemIndex]]
in the pattern will be dynamically replaced by the item's current index, a token of [[itemElIndex]]
will be replaced by the index of the element within the item, and a token of [[index]]
will be replaced by a hyphenated combination of item and element index (i.e., ffa-id-3-2
for the third element inside the fourth item).
Default: data-ffa-id-pattern
Type: string
The attribute that contains the pattern that will be used to create each appended item's name
attribute. See idPatternAttr
description for available token values.
Default: data-ffa-name-pattern
Type: string
The attribute that contains the pattern that will be used to create each appended item's for
attribute. See idPatternAttr
description for available token values.
Default: data-ffa-for-pattern
Type: string
The class applied to an item when it's hidden/disabled. This class can be used to visibly hide disabled items with CSS.
Default: is-disabled
Type: number
The first index value applied to added items.
Default: 1
Type: boolean
Determines whether the first item can be removed.
Default: true
Type: boolean
Determines whether a "remove" trigger is added to all items, or only the last item.
Default: false
Type: function
or null
An optional callback that's fired whenever an item is added.
Default: null
Type: function
or null
An optional callback that's fired whenever an item is removed.
Default: null
Type: boolean
Determines whether the fields in added items contain the values of the original item/template.
Default: true
Parameters: none
Destroys the formFieldAppender instance.
Parameters: none
Returns an array of the items currently added to the formFieldAppender instance.
formFieldAppender depends on the following browser APIs:
To support legacy browsers, you'll need to include polyfills for the above APIs.
FAQs
A module for adding and saving an infinite number of form fields.
The npm package @degjs/form-field-appender receives a total of 0 weekly downloads. As such, @degjs/form-field-appender popularity was classified as not popular.
We found that @degjs/form-field-appender demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.