The field store manages all the registered fields and contains the FieldListener objects. It can be accessed in the browser from window._nb.fields.

all()

This method will return an array containing all the registered fields as FieldListener objects.

_nb.fields.all()
// [FieldListener, ...]

get(ele)

This method will return an array containing FieldListener objects for a specific element node.

var ele = document.querySelector('#my-field');
_nb.fields.get(ele)
// [FieldListener]

initListeners()

This method is called after the page is loaded to register fields when autoFieldHookup is enabled. It will look for any fields using the email type, containing the data-nb attribute or contain the selector specified in selector option.

_nb.fields.initListeners()

registerListener(ele [, broadcastRegisration])

This method will register the specified element with the widget. It accepts two arguments, the first being the node to register and the second being an optional boolean. When set to false, the second argument allows you to silently register a node without it broadcasting the nb:registered event. This argument defaults to true.

// Second argument is optional, it defaults to true
var ele = document.querySelector('#my-field', true)
_nb.fields.registerListener(ele)

removeListeners()

This method will unregister all the fields from the widget. (See unregisterListener)

_nb.fields.removeListeners()

unregisterListener(ele)

This method will unregister the specified field. It will call the destroy method in the FieldListener object.

var ele = document.querySelector('#my-field', true)
_nb.fields.unregisterListener(ele)