NodeBB-Community / nodebb-plugin-forms

Forms for NodeBB
2 stars 4 forks source link

Form Schema #9

Open yariplus opened 9 years ago

yariplus commented 9 years ago

Form Schema is what the designer saves and loads.

Currently stored and retrieved using Settings with some v3 helpers to translate the settings to the DOM.

Current testing schema

forms: [
  { formid: 'example',
    title: 'Visual Title',
    inputs: [ /* input objects */ ],
    method: 'submit', // Normally 'submit', which just stores the submission and runs actions, but can use http POST, GET, etc requests.
    action: '', // url for POST method etc..
    cmd: '', // Data object (paypal etc..)
    captchasite: '',
    container: '' // Bootstrap wrapper
  }
]

Other needed/possible properties:

users: [] // Array of uids that can see/submit this form. (besides admins).
groups: [] // Array of groups that can see/submit this form. (besides admins).
actions: [] // Array of action objects, see Form Actions issue.
expireAt: date // stop accepting new submissions after data.
allowComments: true // Allow comments on form submissions from users listed above.
allowReview: true // Let users to see the form submission/add comments.
allowEdit: true // Let users to edit previous form submissions.
pitaj commented 9 years ago

We should use a factory to build form instances, with prototype methods for:

And anything else that needs to be changed

yariplus commented 9 years ago

Hmm, not sure if necessary with how I'm currently handling the form objects, but I'll have to test it out and see how it looks in code.

If it makes the code look better or easier to read I'll be all for it. I'm thinking it will.

yariplus commented 6 years ago

I decided to use caolan/forms for serializing forms.