@dmitryvim/form-builder 0.6.4 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -408,9 +408,14 @@ const form = createFormBuilder({
408
408
  // Render form
409
409
  form.renderForm(rootElement, schema, prefillData);
410
410
 
411
- // Get form data
411
+ // Get form data — a silent read, safe to poll (v0.7.0: never paints errors)
412
412
  const result = form.getFormData(); // { valid, errors, data }
413
413
 
414
+ // v0.7.0: on the submit click, paint every error next to its field ...
415
+ const checked = form.showErrors(); // same { valid, errors, data }
416
+ // ... and scroll to / focus the first one (does not validate itself)
417
+ if (!checked.valid) form.focusFirstError(); // returns false when nothing is marked
418
+
414
419
  // v0.2.0: Update data without re-rendering
415
420
  form.setFormData({ name: 'John', email: 'john@example.com' });
416
421
  form.updateField('email', 'newemail@example.com');