{{ gFormData.formDescription }}
13 |
11 |
12 | Original Google Form (left) vs Customized Google Form (right)
13 |
14 | ___
15 |
16 | ### Install the package
17 | `npm i custom-gform`
18 |
19 | Run `npm install` to install all dependencies only if you are cloning the project.
20 |
21 | ___
22 | ### API
23 | | API | Description | Params|
24 | | ---- | ----------- | ------|
25 | | get | Retrieve all form data in the same order listed | none
26 | | getBasicData | Returns the form title and description | none
27 | | getByCategory | Retrieve all form data and categorize the questions into its own category (short answers, multiple choice...) | none
28 | vueSubmitForm | Submit form on Vue app with one line of code |(gFormData, formData)
29 |
30 | ___
31 |
32 | ### Supported Question Types
33 |
34 | 0: Short answers
35 | 1: Paragraph
36 | 2: Multiple Choice
37 | 3: Drop Down
38 | 4: Checkboxes
39 | 5: Linear Scale
40 |
41 | ___
42 |
43 | ### Example .get Output
44 |
45 | ```js
46 | // Works with both edit and preview link
47 | const formData = await get("Replace with your Google Form link");
48 |
49 | {
50 | formTitle: 'Custom G Form',
51 | formDescription: 'Form Description',
52 | questions: [
53 | {
54 | entry: 'entry.159023240',
55 | type: 'multiple-choice',
56 | title: 'Multiple choice',
57 | description: 'MC Description',
58 | choices: [ [Object], [Object], [Object] ],
59 | required: false
60 | },
61 | {
62 | entry: 'entry.1862994755',
63 | title: 'Multiple choice',
64 | type: 'multiple-choice',
65 | description: 'MC Description REQUIRED',
66 | choices: [ [Object], [Object] ],
67 | required: true },
68 | {
69 | entry: 'entry.1536591222',
70 | title: 'Short Answer',
71 | type: 'short-answer',
72 | description: 'Description: REQUIRED',
73 | placeholder: '',
74 | required: true
75 | }
76 | ]
77 | }
78 | ```
79 |
80 | ### Example .getByCategory Output
81 |
82 | ```js
83 | // Works with both edit and preview link
84 | const formData = await getByCategory("Replace with your Google Form link");
85 | {
86 | formAction: 'https://docs.google.com/forms/u/0/d/e/1FAIpQLSeHM3lr79IGiu57NR6lwUMqBZDKsp9C5IpzRApgLfdZX2gwkw/formResponse',
87 | formTitle: 'Custom G Form',
88 | formDescription: 'Form Description',
89 | questions: {
90 | shortAnswers: [ [Object], [Object] ],
91 | paragraphs: [ [Object], [Object] ],
92 | multipleChoice: [ [Object], [Object] ],
93 | dropDown: [ [Object] ],
94 | checkBoxes: [ [Object], [Object] ],
95 | linearScale: [ [Object] ]
96 | }
97 | }
98 | ```
99 | ___
100 | ### Return Object Info
101 | | Key | Description |
102 | | ---- | ----------- |
103 | | formAction | POST api to submit the form response
104 | | entry | Use this in the `name` attribute of each form input
105 | | required | Check for required form field
106 | ___
107 |
108 | ### *NEW*: Submit forms with one line of code (VUE ONLY)
109 |
110 | Always validate your form and don't submit empty forms. Remember to import the api as well.
111 |
112 | ```js
113 | import { vueSubmitForm } from 'custom-gform';
114 | ```
115 | ```js
116 | methods: {
117 | /*
118 | Retrieve this.gFormData with the .get api and pass it to the first param
119 | Pass all v-model formData into the second param
120 | Check code in the next section to learn how to dynamically assign v-models for your form
121 | */
122 |
123 | async submitForm() {
124 | // Returns a promise with {code: success/fail}!
125 | await vueSubmitForm(this.gFormData, this.formData);
126 | },
127 | }
128 | ```
129 | Dynamically assigns v-model (view example in examples/vue-bootstrap.vue for more info)
130 | ```js
131 | mounted(){
132 | const dynamicVModel = this.gFormData.questions.map((i) => i.title);
133 |
134 | dynamicVModel.forEach((i) => {
135 | this.$set(this.formData, i, null);
136 | });
137 | }
138 | ```
139 | ___
140 |
141 | ### Vue + Bootstrap Example
142 | Check out the `examples/vue-bootstrap.vue` folder in GitHub for example usage
143 | ___
144 | ### Credits
145 | Custom GForm is created and maintained by [Graphicito](http://graphicito.com). For custom web development solution or Google Form customization, contact us at [Contact Graphicito](http://graphicito.com/contact).
146 |
147 | ___
148 | ### Changelog
149 | ```
150 | 4/11/2020: Added placeholder attribute to the shortanswer paragraph, and dropdown objects. Used for model data binding in custom form if user wishes to add placeholder (which does not exist in Google Form).
151 |
152 | 3/11/2020: Added easy vue form submit without importing axios and name attribute dependency.
153 | ```
--------------------------------------------------------------------------------