|
1 | 1 | # formio.js
|
2 |
| -Common library for including formio in the browser. |
| 2 | +A common library for including Form.io in the browser. |
| 3 | + |
| 4 | +### Usage |
| 5 | +Creating an instance of Formio is simple, and takes only a path (URL String). The path can be different, depending on |
| 6 | +the desired output. The Formio instance can also access higher level operations, depending on how granular of a path |
| 7 | +you start with. |
| 8 | + |
| 9 | +```javascript |
| 10 | +var a = new Formio(<path>); |
| 11 | +``` |
| 12 | + |
| 13 | +## API |
| 14 | + |
| 15 | +`Formio.loadProject()` - Loads the parent Project. |
| 16 | + - Available to any valid Form.io resource URL. |
| 17 | + |
| 18 | +`Formio.saveProject()` - Saves the parent Project, using the given payload. |
| 19 | + - Available to any valid Form.io resource URL. |
| 20 | + |
| 21 | +`Formio.deleteProject()` - Deletes the parent Project. |
| 22 | + - Available to any valid Form.io resource URL. |
| 23 | + |
| 24 | +`Formio.loadForms()` - Loads all of the Forms. |
| 25 | + - Available to any valid Form.ui resource URL. |
| 26 | + |
| 27 | +`Formio.loadForm()` - Loads the given Form. |
| 28 | + - Requires the initial path to be a specific Form URL. |
| 29 | + |
| 30 | +`Formio.saveForm()` - Saves the given Form, using the given payload. |
| 31 | + - Requires the initial path to be a specific Form URL. |
| 32 | + |
| 33 | +`Formio.deleteForm()` - Deletes the given Form. |
| 34 | + - Requires the initial path to be a specific Form URL. |
| 35 | + |
| 36 | +`Formio.loadAction()` - Loads the given Action. |
| 37 | + - Requires the initial path to be a specific Action URL. |
| 38 | + |
| 39 | +`Formio.saveAction()` - Saves the given Action. |
| 40 | + - Requires the initial path to be a specific Action URL. |
| 41 | + |
| 42 | +`Formio.deleteAction()` - Deletes the given Action. |
| 43 | + - Requires the initial path to be a specific Action URL. |
| 44 | + |
| 45 | +`Formio.loadActions()` - Loads all of the Actions for a given Form. |
| 46 | + - Requires the initial path to be a specific Form URL. |
| 47 | + |
| 48 | +`Formio.availableActions()` - Loads all the Actions available for a given Form. |
| 49 | + - Requires the initial path to be a specific Form URL. |
| 50 | + |
| 51 | +`Formio.availableInfo()` - Loads all the settings available for a given Action. |
| 52 | + - Requires the initial path to be a specific Form URL. |
| 53 | + |
| 54 | +`Formio.loadSubmissions()` - Loads all of the Submissions for a given Form. |
| 55 | + - Requires the initial path to be a specific Form URL. |
| 56 | + |
| 57 | +`Formio.loadSubmission()` - Loads the given Submission. |
| 58 | + - Requires the initial path to be a specific Submission URL. |
| 59 | + |
| 60 | +`Formio.saveSubmission()` - Saves the given Submission, using the given payload. |
| 61 | + - Requires the initial path to be a specific Submission URL. |
| 62 | + |
| 63 | +`Formio.deleteSubmission()` - Deletes the given Submission. |
| 64 | + - Requires the initial path to be a specific Submission URL. |
| 65 | + |
| 66 | +## Examples |
| 67 | + |
| 68 | +### Loading a Project |
| 69 | +```javascript |
| 70 | +var a = new Formio('myproject.form.io'); |
| 71 | +var myProject = a.loadProject(); |
| 72 | + |
| 73 | +// Since we started with a Project, we can also load its Forms. |
| 74 | +var myForms = a.loadForms(); |
| 75 | +``` |
| 76 | + |
| 77 | +### Loading a Form |
| 78 | +```javascript |
| 79 | +var a = new Formio('myproject.form.io/myform'); |
| 80 | +var myForm = a.loadForm(); |
| 81 | + |
| 82 | +// Since we started with a specific Form, we can now access its Project. |
| 83 | +var myProject = a.loadProject(); |
| 84 | +``` |
| 85 | + |
| 86 | +### Loading a Submission |
| 87 | +```javascript |
| 88 | +var a = new Formio('myproject.form.io/myform/submission/5736076036db24c3c679e778'); |
| 89 | +var mySubmission = a.loadSubmission(); |
| 90 | + |
| 91 | +// Since we started with a specific Submission, we can now access its Form and Project. |
| 92 | +var myForm = a.loadForm(); |
| 93 | +var myProject = a.loadProject(); |
| 94 | +``` |
0 commit comments