Wiki source code of Copy of New Form Builder

Version 10.1 by rijo on 2022/08/23 17:01

Show last authors
1
2 The Forms tool allows you to create, edit, delete, and manage forms and questions. Creating a form is as simple as defining basic form information, choosing which questions/fields will be included on the form, selecting which products and/or packages, designing the look and feel, and dragging in questions and other elements onto the Form’s webpage using an easy to use WYSIWYG editor. When a user completes and submits a form, all of the demographic and transaction information from the form is saved in the ONEcount database.
3
4 \\
5
6 \\
7
8 When a user completes and submits a form, all of the information gathered from the form is entered into the ONEcount database. Plan forms carefully to ensure that you include questions and possible responses that will provide you with all the data you wish to collect from subscribers/purchasers.
9
10 \\
11
12 \\
13
14 **Questions are shared among ALL forms, so any changes made to question type, text, responses, alias, report header (See Question Builder - Create and Manage Questions for more detail) will change ALL forms, not just the form you are working on. Deleting a question will remove that question from ALL forms as well. **
15 **Changes made to form information, form layout, order of questions, and optional validations will NOT universally change forms – these changes will be applied only to the form you are working on.**
16
17 \\
18
19 Form-related tasks include:
20
21 * creating database fields/questions available for placement in online forms; (See __[[Questions - Create and Manage Questions>>url:http://docs.onecount.net:8090/display/OD/Questions+-+Create+and+Manage+Questions||shape="rect"]]__ for more detail.)
22 * creating new forms;
23 * managing existing forms;
24 * creating source codes that are used to track the source of a name/transaction;
25 * and creating individually branded, designed forms.
26
27 \\
28
29 The first task listed above – creating questions is accomplished using the Question Builder tool. The next two tasks – creating new forms and managing existing forms – are carried out using the Form Builder tool under INVENTORY. Creating source codes is handled under __[[Source Codes>>url:http://docs.onecount.net:8090/display/OD/Source+Codes+-+How+to+Create+and+Manage+Source+Codes||shape="rect"]]__ and creating branded forms is handled under __[[Brands>>url:http://docs.onecount.net:8090/display/OD/Brand+-+How+to+Create+and+Manage+Brands||shape="rect"]]__. All of these tools are found under INVENTORY.
30
31 [[image:attach:Form-builder-nav.png||height="250"]]
32
33 \\
34
35 __PHASE A: Defining the Form__
36
37 __[[image:attach:FormDefinitionAug22.png||height="250"]]__
38
39 \\
40
41 1. Required: Give your Form a title. You will have an option to use this title when designing the form in Phase D. If you want to use a different title when designing the form you may do so by using a custom “text section” content block when designing the form.[[image:attach:FB Title.png||height="250"]]
42 1. Give your Form a description. You will have an option to use this title when designing the form in Phase D. If you want to use a different title when designing the form you may do so by using a custom “text” content block when designing the form.
43 1. Required: Assign a source code to a Form. To add or change existing source codes, go to the source code manager in the inventory tab of the navigation bar at the top. If you do not have a source code for this form then use a generic source code.
44 1. If choosing popup as the 'Form Type', for best viewing experiences, please ensure that the minimum width and height used are 350-400.
45 1. OPTIONAL: If you want to direct users to a specific page after submitting the form, then place the url into the "Thank you page URL" field.
46 1. Select a submission option ~*~*~*~*~*~*~*~*~*~**
47 1. Show only relevant products ~*~*~*~*~*~*~*~**
48 1. Enter the text/message to be displayed if an email already exists.
49 1. Body markers that may be used in the text are as follows:
50 %%TEXT%% – will link to Sign in page%%
51 ~#~#TEXT - will be linked to Password Reset page~#~#
52 1. STATUS: Activate the Form for user access or disable the form.
53
54 \\
55
56 \\
57
58 PHASE B: Adding Demographic Questions.
59
60 [[image:attach:AddingDemoQuesAuf22.png||height="400"]]
61
62 \\
63
64 1. Start by adding your first demographic question. In the first dropdown box all ONEcount questions that are in your question inventory will appear in the dropdown menu list.  You may also type the question name or number into the dropdown box to find a question to add.
65 1. VALIDATIONS: If needed, select validation(s) to require a specific format for responses to this question. Validations include alphanumeric, date, email, or is a required field. In email match (email address matches the email in the “email” question/field), or is a number. Multiple validations can be added to each question.
66 1. AUTO POPULATE: You may choose to have fields auto populated for identified users by setting the auto populate switch to yes.
67 1. To add additional questions, click the “Add” button in the top right hand corner.
68 1. To remove a question click the “X” at the end of the respective row.
69
70 \\
71
72 PHASE C: Add Products and Packages.
73
74 [[image:attach:form-builder-products-Aug22.png||height="400"]]
75
76 In this phase, you can add a single product or package, or a combination of multiple products and packages.
77
78 **PRODUCTS: **Add a single product resource, like a e-newsletter, webinar, whitepaper or single issue magazine purchase. Optional: to have a product automatically selected, choose which option to have selected using the “Pre-Selection” dropdown.
79
80 **~ **
81
82 1. Choose a template for how you want product options displayed. Examples of template types are in the images below. ~*~*~*~*~*~*~*~*
83 1. Select the first product you would like to include on the form. All the products created within ONEcount will appear in the product drop down. To search for a specific product, you can type the product name or ID number into the field.
84 1. Preselection ~*~*~*~*~*~*~*~*
85 1. To add additional products- click the add product button in the right hand corner.
86 1. To remove a product, click an X
87
88 \\
89
90 **PACKAGES:** Add a group of products, like a digital and print subscription, multiple issue magazine subscription, a magazine subscription and e-newsletter, digital access or other bundled resources with a term duration (expiration date) or access limit. Optional: to have a package automatically selected, choose which option to have selected using the “Pre-Selection” dropdown.
91
92 1. Choose a template for how you want Package options displayed. Examples of template types are in the images below. ~*~*~*~*~*~*~*~*
93 1. Select the first package you would like to include on the form. All the packages created within ONEcount will appear in the product drop down. To search for a specific product, you can type the package name or ID number into the field.
94 1. Preselection ~*~*~*~*~*~*~*~* Term/Type
95 1. To add additional packages- click the add product button in the right hand corner.
96 1. To remove a package, click the X
97
98 \\
99
100 **Pre-selection of Products and Packages with query string **
101
102 In order to preselect the terms via the query string, a comma-separated value of term ids can be passed as a query string on parameter name "terms". The respective packages for the given term ids should be present on the created form. The term ids can be appended on the URL as:
103 \\&terms=991,1002
104 \\Similarly, to preselect the products via the query string, a comma-separated value of product ids can be passed as well on parameter name "prods". The given product id should be present on the created form. The product ids can be appended on the URL as:
105
106 &prods=10001,20001
107
108 \\
109
110 \\
111
112 PHASE D: Designing the Form
113
114 This is an example of a form built using the form builder.
115
116 [[image:attach:Editori-main-menu copy.png||height="250"]]
117
118 Use the editor to customize the look and feel of your form webpage. To add page and form elements, drag the element(s) from the menu on the right to where you want them to appear. Sections of the Elements menu can be collapsed for ease of use to drag in content blocks that are located lower in the menu.
119
120 \\
121
122 To create additional content areas, start by adding a “Grid Template” from the Elements menu.
123
124 [[image:attach:FB Grid Template.png||height="250"]]
125
126 \\
127
128 Form Building is a multi-step process. 
129
130 Form can be built from scratch.  It requires, at the very minimum, a Captcha and Submit button, if building from scratch.  If choosing to do so,
131
132 1. Navigate to the 'Form Design' tab, after you have filled out the basic information as required by the 'Form Definition,' 'Add Demographics,' and 'Add Products/Packages' tabs.
133 1. The canvas can be populated by dragging-and-dropping elements/components from the right-hand panel.  
134 11. Simply select your choice of component from the options in the right-hand panel with your mouse
135 11. Drag it over to the spot on the canvas, as you prefer
136
137 \\
138
139 Let's start with selecting a grid format from the 'Grid Templates' option in the right-hand panel. This helps with adding elements to the canvas, eventually your form, in an organized/disciplined manner.
140
141 Below is a screen-shot where the 'Grid Templates' expands on beings selected, and the 'three column' grid is chosen
142
143 [[image:attach:formbuilder-three-column-demosAug23.png||height="250"]]
144
145 1. First, let's expand the 'Grid Templates' option by selecting it.
146 1. Select the preferred column type, then drag it to the canvas, as shown below (three-column grid selected)
147
148 (% style="margin-left: 40.0px;" %)
149 [[image:attach:formbuilder-drag-a-grid-onto-canvas.png||height="250"]]
150
151 (% style="margin-left: 40.0px;" %)
152 3. To populate the columns, let's choose from the 'Demographics' option.
153
154 (% style="margin-left: 40.0px;" %)
155 4. Select First Name and drag it to the left-most cell, followed by Last Name to the middle cell, next email to the last one.
156
157 (% style="margin-left: 40.0px;" %)
158 [[image:attach:formbuilder-drag-fields-from-toolbar-onto-canvasAug23.png||height="250"]]
159
160 1. The three-column grid will look as follows:
161 1. [[image:attach:formbuilder-three-column-demosAug23.png||height="250"]]
162 1. To add Captcha to the form, select 'Form' from the right-hand panel[[image:attach:Screen Shot 2022-08-23 at 4.52.47 PM.png||thumbnail="true" width="150"]]
163 1. Select Captcha and drag it over to the spot on the canvas.  In this case, we choose below the 3-column grid
164 1. [[image:attach:formbuilder-add-captchaAug23.png||height="250"]]
165 1. To add a 'Submit' button, select it from the 'Form' option and drag it to the spot you prefer on the canvas, eventually this position will impact how your final form is displayed)
166 1. Below is what the final form/pop-up will look like after the additions/modifications described in steps 1-4
167
168 [[image:attach:formbuilder-completed-formAug23.png||height="250"]]
169
170 \\
171
172 ELEMENTS MENU
173
174 \\
175
176 To add elements, like titles, text blocks, images/logos, products/packages, or questions/fields use the Elements menu (image).
177
178 1. Begin creating a layout by first adding **Grid Templates. **First add One Column Grid Templates to define the basic layout. For multiple columns, add a one column Grid Template before dragging 2 or 3 column Grid Templates into the form.
179 1. To add a Title and Description, drag in the “Title” or “Description” content blocks from the “Form Info” section of the Elements menu. The “Title and Description” will be what you have entered during Phase 1, Form Definition.
180 11. To create a custom heading or text block, add a “Text” or “Text Section” from the list of products near the lower part of the Elements menu.
181 11. Click [[here>>attach:formbuilder-R-YTVideo-Aug23.mp4]] to view how you can add a Youtube video to your form.
182 11. To add Products/Packages drag in the Product or Package from the Elements menu on the right. The layout of Products or Packages will be based on what Template Type you selected during Phase 3, Add Products & Packages.
183 11. Adding Images, first drag the image icon from the Elements Menu and place it where you want an image to be placed.
184 111. A pop-up window will open with a library of images already added.
185 111. To add a new image, click the left-hand side of the image pop-up window. Using the folder browser, choose an image from your files that you would like to upload.
186 111. After uploading an image file, select the image from the image library list on the right hand side.
187 111. After selecting your image, click the “X” button to close the image library. Your image will be placed in the image content block.
188 111. Here is a video showing how to select images to your canvas: [[How to upload image video>>attach:formbuilder-AddImage-R-Aug23.mp4]]
189 111. To add Questions/Fields drag the questions you have selected during Phase 2, “Add Demographics”, from the “Demographics” section of the Elements menu.
190 1111. It is recommended to place each Question in individual Grid Templates (single or multiple column).
191 1111. To add additional questions, return to Phase 2 “Add Demographics”.
192
193 Once created, we can edit the added elements to the canvas.  Let us see how URL links can be added and how to the 'paint brush' icon can be used.
194
195 1. URL links can be added to components that use the 'Link' feature. 
196 11. To add or modify a URL link, use the 'Components Settings' option on the toolbar, denoted by a 'gear' icon [[image:attach:Screen Shot 2022-08-23 at 2.25.10 PM.png||thumbnail="true" width="20"]]on the above toolbar.
197 11. You can add URL to the 'Href' field, which will then link the selected component to the URL specified in this field.
198 11. Please [[click here>>url:http://bos-jira01-cl01.onecount.net:8080/secure/attachment/15323/Aug-23-2022%2012-23-41.mp4||shape="rect"]] to view a video showing how to create a URL link.
199 1. Components can be modified in terms of typography(text-related features such as fonts, alignment), dimensions (height, width, padding, etc.) or background decorations (color, radius, etc.). 
200 11. To do so, select the component, then click on the 'paintbrush' icon on the above toolbar, denoted by[[image:attach:Screen Shot 2022-08-23 at 2.28.56 PM.png||thumbnail="true" width="20"]].  In the screen shot below, the image on the right is selected and editted.
201
202 (% style="margin-left: 80.0px;" %)
203 [[image:attach:formbuilder-edit-object-propertiesAug23.png||height="400"]]
204
205 (% style="margin-left: 80.0px;" %)
206 b. Please [[click here>>attach:formbuilder-R-PaintBrush-Aug23.mp4]] to view a video showing how a button's background color was changed.
207
208 \\
209
210 TEMPLATES MENU
211
212 The Templates menu contains a set of four pre-designed set of templates you can choose from. Clicking on the Templates option, (found on the right-hand panel) displays the template set.
213
214 [[image:attach:TEMPLATES menu Aug22.png||thumbnail="true" height="250"]]
215
216 \\
217
218 To use a template, drag-n-drop the preferred template from the right-hand panel to the canvas.
219
220 To drag-n-drop a template, first click on the 'Templates' option in the right-hand panel.  This will display the templates.  Now, choose a template and drag it to the canvas to the left, as shown below.
221
222 [[image:attach:Drag-n-DropTemplate.png||height="250"]]
223
224 \\
225
226 The various types of templates include:
227
228 1. Three-column with graphic
229 1. Two-column with graphic
230 1. One column/graphic on top
231 1. One-column graphic click-through
232
233 The Demographic components and other features can be added to the forms per the designated space provided in the chosen template.
234
235 The templates are designed to be responsive, that is moldable to the various screen-sizes.  These can be used for either 'Forms' or 'popups.'
236
237 Please Note: For ease of use, please ensure the canvas is empty before the drag-n-drop.
238
239 \\
240
241 STYLE MENU
242
243 To customize the design or CSS styles like dimensions, typography and colors use the CSS editor ().
244
245 [[image:attach:object-tools.png||height="250"]]
246
247 1. First, select which element you would like to modify. Elements can be designed at the Grid Template, Content Block, Product/Package, or Question level. Then click on the paint-brush tool on the upper-right nav bar of the form builder.
248 1. Elements sharing common “classes” will be globally changed when edited. To edit the appearance of just a single content block either remove classes or select the element individually.
249 1. DIMENSION: Edit the margin and padding size of content blocks or Grid Templates. Adjustments can be made by using either pixel or percentage.
250 11. Click on the “px” or “%” to switch units.
251 11. TYPOGRAPHY: Edit fonts, font sizing, font color, alignment, and other typographical styling.
252 11. DECORATIONS: Edit background colors, borders of content blocks or individual elements.
253 111. Make sure the Opacity Slider is set above 10% for color edits to be visible. It is recommended to move the Opacity Slider all the way to the right.
254
255 \\
256
257 To alter the text of a button (like a submit, etc) select the button and click on the gear icon on the upper-right:
258
259 [[image:attach:editor-object-settings.png||height="250"]]
260
261 \\
262
263 To preview, click the Preview link at the top.
264
265 Elements Menu: (add the four square image). The Component Manager
266
267 ADDING LINKS TO FORMS
268
269 1. Select the text that you would like to hyperlink. Then click the hyperlink button () that appears last on the black edit bar.
270 1. Next, deselect the content block.
271 1. Now, click the linked text.
272 1. Open the component settings by clicking the gear icon at the top. ()
273 1. Paste or type the url destination for the link into the “Href” field. You may also add a title and specify a target for the link.
274
275 \\
276
277 PHASE E: EMAIL CONFIRMATION
278
279 The Email Confirmation tab is used to fill out details of the confirmation email.
280
281 [[image:attach:form-builder-EmailConfirmationTabAug23.png||height="250"]]
282
283 1. **Email Confirmation (Yes/No) **is where you select whether a confirmation email will be sent upon subscription to/registration for any products listed on the form.
284 11. **a.     Enter Acknowledgement Email Information. (See Items b-c below.)**
285 11. This is where you can create customized acknowledgement emails specific to the form/product attached to the form. Creating these customized emails is optional, as default acknowledgement emails not specific to any form and/or product are configured in the Configuration Manager.
286 11. Enter the subject of the email in "New Thank You Email Subject" field.
287 Enter the content of the email in "New Thank You Email" field. 
288 Body markers that may be used in the text are as follows:
289 %%USERNAME%% – will replace the body marker %%USERNAME%% with the subscriber's username.
290 %%PASSWORD%% – will replace the body marker %%PASSWORD%% with the subscriber's password.
291 %%ONECOUNTID%% – will replace the body marker %%ONECOUNTID%% with the subscribers account number/ONEcount ID.
292 %%RECEIPTDISPLAY%% – will replace the body marker %%RECEIPTDISPLAY%% with a receipt for purchase amount, if any.
293 11. Enter the content of the email in the "Update Thank You Email" field.
294 Enter the subject of the email in the "Update Thank You Email Subject" field.
295 Enter the email address for BCC in the "Email Confirmation BCC" field.
296
297 \\
298
299 PHASE F: DESIGNING THANK YOU PAGE
300
301 The 'ThankYou Page Design' tab helps in designing a thank you page after form has been submitted.
302
303 Below is a screen-shot of the default Thank you page template, that is automatically populated in the 'Thank you Page Design' tab.
304
305 [[image:attach:TYPageDesign-Aug22.png||height="400"]]
306
307 Up to four templates, that are drag-n-droppable, are provided in the right-hand panel.  To view them, please click on the 'Thank you Templates' option in the right-hand panel.
308
309 [[image:attach:TYClosePanelAug23.png||height="250"]]
310
311 These templates can be further customized using the components from the form builder, such as the Submit button, Captcha, Demographics components, and such.
312
313 So, we now have three ways for designating a Thank you page:
314
315 ~1. Provide a URL in the 'Thank you Page URL' field found in the 'Form Definition' tab.  This has priority over the following two steps (2. and 3.)
316
317 [[image:attach:FormDefn-TYURLAug23.png||height="250"]]
318
319 \\
320
321 2. Choose a preferred template from the 'Thank you Page Design' tab.  If step 1. is not provided, step 2. takes priority, if provided.
322
323 3. Using the default Thank you page.  This comes into play if steps 1. and 2. are left blank.  This is also what will be used for the older forms (that did not have the Thank You Page Design feature).
324
325 The older forms that did not have the 'Thank you Page Design' feature, will now include this feature so that the 'Thank you' pages are now customizable
326
327 The templates provided in the 'Thank you page Design' tab are responsive.
328
329 The default Thank you page looks as shown below:
330
331 [[image:attach:DefaultTY-Aug22.png||height="250"]]
332
333 The default values in the Thank you page are populated from the Config Manager.
334
335 To delete a template from the canvas, click on the 'trash can' icon found on the above toolbar.
336
337 [[image:attach:TYDeleteIconAug23.png||height="250"]]
338
339 \\
340
341 Please [[click here>>attach:formBuilder-TYSelectDelete-Rayaan-OC2201.mp4]] to view video showing how to select and delete a 'Thankyou Page Design.'
342
343 \\
344
345 \\
346
347 TO DUPLICATE A FORM
348
349 1. From the “Manage Forms” page click the copy icon at the end of the row for the form you wish to copy. ()
350
351 \\
352
353 TO EDIT A FORM
354
355 \\
356
357 1. Click the Pencil Icon () towards the end of the row of the Form that you wish to edit. ()
358
359 DELETING A FORM
360
361 1. Click on the Trash Icon () towards the end of the row of the Form that you wish to delete. ()
362
363 \\
364
365 **~ **
366
367 (% style="margin-left: 0.0px;" %)
368 (((
369 (% class="pagetitle with-breadcrumbs" %)
370 (((
371 (% class="with-breadcrumbs" %)
372 = New Form Builder Notes: =
373 )))
374 )))
375
376 (% class="page view" %)
377 (((
378 (% class="wiki-content" %)
379 (((
380 == Along with customization and new product templates it does: ==
381
382 * Registration
383 * Subscription, Unsub and Renew
384 * Login, Lookup
385 * Progressive lookup
386 * Smartlink login
387 * Redirect to landing and sending email after form submission
388 * Payment
389 )))
390 )))
391
392 = CREATE LANDING PAGE FOR FORM: =
393
394 To create landing page for form, select template type as Landing Page in form-builder Add Product & Package tab as shown in image below:
395
396 [[image:attach:image2020-10-9_14-8-52.png||height="250"]]
397
398 \\
399
400 After selecting template type as landing page select redirect form from the drop down. Drag and Drop the package or product from blocks to the canvas from design tab. Below is the image of landing page design.
401
402 [[image:attach:image2020-10-9_14-9-30.png||height="250"]]
403
404 \\
405
406 The images on the design is from the URL present to that package or product as shown in image below.
407
408 [[image:attach:image2020-10-9_14-9-51.png||height="250"]]
409
410 \\
411
412 = ADDING BRAND HEADER AND FOOTER TO FORMS: =
413
414 There are two ways to add brand header and footer to form builder forms.
415
416 * You can add brand id at the end of Form URL to automatically apply brand header and footer for the form.
417
418 Ex: [[https:~~/~~/client.onecount.net/>>url:https://client.onecount.net/||shape="rect"]] /onecount/form/display.php?id=53464b88-c391-479f-82cf-e1cd19a870cd&brand=brandid
419
420 * By selecting a brand from the dropdown present in tab definition tab.
421
422 \\
423
424 Once brand is selected you can drag brand header and footer from design tab and edit them. Editing brand header and footer gives flexibility to remove or change design or text for the particular form.
425
426 \\
427
428 = CREATING POPUPS USING FORM BUILDER: =
429
430 These popups are used in action manager for targeting and for gating products. Below are the steps to create form which behaves as popup.
431
432 * Select the type of form from the dropdown in Form Definition tab.
433 * If form type is popup then popup config fields are displayed. Below are the fields which define behavior of popup.
434 ** Popup Width - It define width of a popup.
435 ** Popup Height – It define height of a popup.
436 ** Popup Horizontal Position - It define the horizontal position of popup on screen.
437 ** Popup Vertical Position – It define the vertical position of popup on screen.
438 ** Popup Slide Position – It define from which side popup should slide before appearing on position.
439 ** Popup Delay – It define how much time popup should take to appear on screen.
440
441 ===== Prerequisite: As these forms appear as popup on the client site, you will need to add a CNAME record in your domain's DNS so that the pop-up and form code can be loaded from our servers into your domain. So if your domain is abc.com, you will need to add a CNAME record mapping oc.abc.com to <client>-[[reg.onecount.net>>url:http://reg.onecount.net||shape="rect"]]. Then this is done, any request going to oc.abc.com will actually to go your registration server at <client>-reg.onecount.net for loading the pop-up code and setting cookies. =====
442
443 ===== ·      Popup setup for gating: Once popup is created you need to create the Packages/Products for gated content. While creating the Package/product you need to select “Form” as “Primary Form or Landing Url” option. Then select the popup form created in the previous step. A text box will be displayed as below =====
444
445 ===== You can use this to ensure CNAME set up is done correctly. This box will be auto filled with <client>-[[reg.onecount.net>>url:http://reg.onecount.net||shape="rect"]] but If you need to gate a page or section on site [[abc.com>>url:http://abc.com||shape="rect"]] then enter oc.[[abc.com>>url:http://abc.com||shape="rect"]] in text box (because popup will appear on [[abc.com>>url:http://abc.com||shape="rect"]], This step is just for CNAME setup validation). If CNAME setup is not done, then it will throw warning while saving Product/Package. Also, the pop-up won't work on your site. =====
446
447 ===== ·      Popup setup for targeting: Once popup is created you need to create the action in action manager. While creating the action manager select popup form created. If popup should appear on site [[abc.com>>url:http://abc.com||shape="rect"]] then enter oc.[[abc.com>>url:http://abc.com||shape="rect"]] in Target Domain. We will check if CNAME set up is done correctly, if not error will be warning. =====
448
449 **Extra Scripts/Extra Styles:
450 **These boxes allow you to add additional Javascript code or CSS to your forms to alter the appearance or function of the form.
451
452 [[image:attach:image2020-10-9_14-10-26.png||height="250"]]
453
454 \\
455
456 One use for these boxes is to add Javascript code to your form that will change the questions and/or question responses based on a user’s response to a question on the form.
457
458 **Code for altering responses based on select type demographics:**
459
460 \\
461
462 **Example:** If a form contains a question which ask whether the user is a doctor or a patient. If the user selects doctor the demographic fields which are related to doctor will appear (type of specialty, NPI #, medical degree achieved, etc.). Otherwise, demographic fields for a patient will appear on the form. This modifications helps to show user only those demographic fields which are related to their previous answers.
463
464 \\
465
466 **Example Sample Code:**
467
468 \\
469
470 removeInitial = [1043,859,659,683,699,707,723,731,747,771,779,787,795,867,915,739,763,1059,1075,1083,1091,755];
471
472 \\
473
474 var hcpObj = {
475
476 "dropDownId" : 1051,
477
478 "whenSelcectedItem" : [{
479
480 "Yes" : [659],
481
482 "No" : [683],
483
484 }],
485
486 "itemsDisplayWhenSelected" : [659,683,699,707,723,859,731,915,867,747,787,1043,779,771,795,739,763,1059,1075,1083,1091,755]
487
488 };
489
490 document.getElementById("q_id_1051").onchange = function(){autoDropDown(hcpObj)};
491
492 \\
493
494 var hcpNoObj = {
495
496 "dropDownId" : 683,
497
498 "whenSelcectedItem" : [{
499
500 "Patient Role" : [1059,1211],
501
502 }],
503
504 "itemsDisplayWhenSelected" : [659,699,707,723,859,731,915,867,747,787,1043,779,771,795,739,763,1059,1075,1083,1091,755]
505
506 };
507
508 document.getElementById("q_id_683").onchange = function(){autoDropDown(hcpNoObj)};
509
510 \\
511
512 \\
513
514 **Steps:**
515
516 * Initialize removeInitial variable and pass an array of demographics ids which you want to hide when form is loaded.
517 * Create an object with any name and this object should contain 3 elements
518
519 1. dropDownId – You need to pass an id of select type whose action must be taken.
520 1. whenSelectedItem – You need an array of object this will be the response for the each select type from the dropdown. Key will be the response type and value will be the array of demographics id which should appear when this key is selected.
521 1. ItemsDisplayWhenSelected – This is array of demographics id, ids which are hidden before selecting the action for the demographic select type.
522
523 * getElementById("q_id_1051") – 1051 will be the demographics id which will be same as dropDownId.
524 * autoDropDown(hcpNoObj) – autoDropDown() function is called and object which is created above will be passed as a parameter this function implements the response base altering the demographics.
525
526 \\
527
528 **Note:**
529
530 * removeInitial is assigned only once at the beginning of the script.
531 * All the code must be included in form extra script area.
532
533 \\