Listens for data changes from elements within a HTML form element.
Input elements must have a 'name' attribute.
Simple usage:
constrx = Rx.From.domForm(`#my-form`); rx.onValue(value=> { // Object containing values from form });
rx.last(); // Read current values of form
UI can be updated
// Set using an object of key-value pairs rx.set({ size:'large' });
// Or set a single name-value pair rx.setNamedValue(`size`, `large`);
If an 'upstream' reactive is provided, this is used to set initial values of the UI, overriding
whatever may be in the HTML. Upstream changes modify UI elements, but UI changes do not modify the upstream
source.
// Use this as initial values for a HTML form // (assuming appropriate INPUT/SELECT elements exist) constrx = Rx.From.domForm(`form`, { upstreamSource:obj });
// Listen for changes in the UI rx.onValue(value=> { });
Listens for data changes from elements within a HTML form element. Input elements must have a 'name' attribute.
Simple usage:
UI can be updated
If an 'upstream' reactive is provided, this is used to set initial values of the UI, overriding whatever may be in the HTML. Upstream changes modify UI elements, but UI changes do not modify the upstream source.