Meteor-Community-Packages / meteor-autoform

AutoForm is a Meteor package that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive validation.
MIT License
1.44k stars 328 forks source link

Access fields data before form save #1024

Closed mchan75 closed 3 years ago

mchan75 commented 9 years ago

I have the following fields as part of my Meteor autoform schema, problem I am facing is that if the user entered many records the form will expand vertically a lot, so I was wondering if there is any way to access the data (specifically records saved under Items) so that I can display them in a table to be easily viewed by the user OR if this is not possible, is there anyway I can have each of the ITEMS sub-fields placed in a separate column so that they can all come on one line? Thanks

  ITEMS: {
      type: Array,
      label: "Invoice Items",
      optional: true
  },
  "ITEMS.$": {
      type: Object
  },
  "ITEMS.$.ItemCode": {
      type: String,
      label: "Item Code"
  },
  "ITEMS.$.ItemName": {
      type: String,
      label: "Item Name"
  },
  "ITEMS.$.ItemQty": {
      type: String,
      label: "Item Qty"
  },
  "ITEMS.$.ItemPrice": {
      type: String,
      label: "Item Price"
  },
  "ITEMS.$.ItemDiscount": {
      type: String,
      label: "Item Discount"
  },
  "ITEMS.$.ItemTotal": {
      type: String,
      label: "Total"
  }
fuzzybabybunny commented 9 years ago

https://github.com/aldeed/meteor-autoform#getting-current-field-values

So something like:

AutoForm.getFormValues('my-form-id');

Would return an object containing all the values entered so far in the form.