generateIdFromForm

Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.dom.form

This function generate a uniqid based on the form element passed using these rules:

  1. If the form has an action attribute, this will be used to generate the uniqid.
  2. If not, the function will generate a uniqid based on the form attributes and named controls.

Note that the named controlls will be sorted before generating the uniqid.

Params

  1. $form*-HTMLFormElement

    The form element to generate the uniqid from

Return

  1. -String

    A uniqid

Example

import { generateIdFromForm } from '@blackbyte/sugar/dom';
const id = generateIdFromForm($myForm); // => a md5 hash id

Todo

  • testsnormal