Wiki source code of Embedding Forms in Web Pages
Version 4.1 by melanie@one-count_com on 2016/11/09 17:46
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
3.1 | 1 | |
2 | |||
3 | {{id name="Start ScreenSteps Content"/}} | ||
![]() |
4.1 | 4 | (% style="color: rgb(128,128,128);" %)//By default, when a ONEcount form is called it will display on its own landing page or as a pop-up. If, however, you want to embed a short form on a web page containing other content, e.g. display a newsletter sign-up form on your home page and/or article pages, you can include some javascript with an option object to do so.// |
![]() |
3.1 | 5 | |
![]() |
4.1 | 6 | (% style="color: rgb(128,128,128);" %)//This lesson provides direction on the steps to embed a form on a web page.// |
![]() |
3.1 | 7 | |
8 | === 1. Include a div with id wherever you want the form to be embedded. === | ||
9 | |||
10 | The id name can be whatever you choose, e.g. “oc-form” as in the example below. | ||
11 | |||
12 | In ONEcount, the height and width is set to 100% , so the height and width defined in the div will be the actual size of the form. | ||
13 | In the example below, the height and width will be 1500px. | ||
14 | |||
![]() |
4.1 | 15 | (% style="color: rgb(0,128,128);" %)** <div**(% style="color: rgb(127,0,127);" %)** id**(% style="color: rgb(44,44,44);" %)**=**(% style="color: rgb(0,0,255);" %)**//"oc-form"//**(% style="color: rgb(127,0,127);" %)** style**(% style="color: rgb(44,44,44);" %)**="**(% style="color: rgb(127,0,127);" %)**width//: //**(% style="color: rgb(127, 0, 127); color: rgb(0, 0, 255)" %)**//1500px//**(% style="color: rgb(44,44,44);" %)**;**(% style="color: rgb(128,0,128);" %)**height//~://**(% style="color: rgb(0,0,255);" %)**//1500px//**(% style="color: rgb(51,153,102);" %)**></div>**(% style="color: rgb(63,127,127);" %)** ** |
![]() |
3.1 | 16 | |
17 | === 2. Call the GCN object with options after the div. === | ||
18 | |||
19 | **Include the script** – example shown below – **after the div.** Options are defined below the example. | ||
20 | |||
21 | **Example:** | ||
![]() |
4.1 | 22 | (% style="color: rgb(0,128,128);" %)<script> |
23 | (% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0)" %) (% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0); color: rgb(128, 0, 128)" %)var(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0)" %) option ={'(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0); color: rgb(128, 0, 128); color: rgb(0, 0, 255)" %)containerid(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0)" %)' : 'oc-form','(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0); color: rgb(128, 0, 128); color: rgb(0, 0, 255); color: rgb(0, 0, 255)" %)domain(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0)" %)' : '[[(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0); color: rgb(128, 0, 128); color: rgb(0, 0, 255); color: rgb(0, 0, 255); color: rgb(0, 0, 0)" %)sonish.onecount.net>>url:http://sonish.onecount.net||shape="rect"]](%%)','type' : 'form', '(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0); color: rgb(128, 0, 128); color: rgb(0, 0, 255); color: rgb(0, 0, 255); color: rgb(0, 0, 0); color: rgb(0, 0, 255)" %)formid(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0)" %)' : 777}(% style="color: rgb(0,128,128);" %) | ||
24 | (% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0)" %) GCN. onecount.form.embed(option);(% style="color: rgb(0,128,128);" %) | ||
25 | </script>(%%) | ||
![]() |
3.1 | 26 | |
27 | \\(% style="text-decoration: underline;" %)Options(%%): | ||
28 | |||
29 | **containerId :** This is a required option that must be included. It is the id of the div, created in Step 2 above, where the form will be embedded. | ||
30 | |||
31 | **domain :** This is a required option that must be included. This is your site domain where ONEcount is associated, so will precede your domain. (example: ab-admin.cde1234.com) | ||
32 | |||
33 | **type :** This is a required option that must be included. This option will determine what type of form to embed: | ||
34 | |||
35 | * a standard form, | ||
36 | * a lookup/login form, or | ||
37 | * a lookup form. | ||
38 | |||
39 | **NOTE that** GCN.onecount.form.embed(option); **must be placed on a new line OR alternatively, you can keep it on the same line and precede with a semicolon:** | ||
40 | |||
![]() |
4.1 | 41 | (% style="color: rgb(0,128,128);" %)**<**(% style="color: rgb(63,127,127);" %) script(% style="color: rgb(0,128,128);" %)> |
![]() |
3.1 | 42 | |
![]() |
4.1 | 43 | (% style="color: rgb(0,128,128);" %) (% style="color: rgb(128,0,128);" %)var(%%) option ={'(% style="color: rgb(0,0,255);" %)containerid'(%%) : 'oc-form','(% style="color: rgb(0,0,255);" %)domain'(%%) : '[[sonish.onecount.net>>url:http://sonish.onecount.net||shape="rect"]]','(% style="color: rgb(0,0,255);" %)type(%%)' : 'form', 'formid' : 777} ; GCN. onecount.form.embed(option); |
44 | (% style="color: rgb(51,153,102);" %)</script>(%%) | ||
45 | (% style="color: rgb(127,0,85);" %) | ||
![]() |
3.1 | 46 | |
![]() |
4.1 | 47 | (% style="text-decoration: underline; color: rgb(0, 64, 128); text-decoration: underline" %)**Standard ONEcount Form** |
48 | |||
![]() |
3.1 | 49 | [[image:attach:media_1476291374169.png||align="center"]] |
50 | |||
51 | (% style="text-decoration: underline;" %)**To embed a standard ONEcount form**(%%)**:** | ||
52 | |||
53 | **type : form** – This choice will embed the ONEount form, and it requires the form ID to be passed. When both are passed, ONEcount will embed the form with that form id. | ||
54 | |||
![]() |
4.1 | 55 | **formid : [[OC form id>>doc:OC form id]]** – The id of the form to embed. (The form ID can be found under Manage Forms in the Inventory module.) |
![]() |
3.1 | 56 | |
![]() |
4.1 | 57 | (% style="color: rgb(0,0,0);" %)**Example of script to embed standard ONEcount form #777 created under sonish.onecount.net domain:** |
![]() |
3.1 | 58 | |
![]() |
4.1 | 59 | (% style="color: rgb(0,128,128);" %)**<**(% style="color: rgb(63,127,127);" %) script(% style="color: rgb(0,128,128);" %)> (% style="color: rgb(128,0,128);" %) |
60 | var(%%) option ={'(% style="color: rgb(0,0,255);" %)containerid'(%%) : 'oc-form','(% style="color: rgb(0,0,255);" %)domain'(%%) : '[[sonish.onecount.net>>url:http://sonish.onecount.net||shape="rect"]]','(% style="color: rgb(0,0,255);" %)type(%%)' : 'form', 'formid' : 777} ; GCN. onecount.form.embed(option); | ||
61 | (% style="color: rgb(51,153,102);" %)</script>(%%) | ||
62 | (% style="color: rgb(0,128,128);" %) | ||
![]() |
3.1 | 63 | |
![]() |
4.1 | 64 | (% style="text-decoration: underline; color: rgb(0, 64, 128); text-decoration: underline" %)**Lookup/Login Form** |
65 | |||
![]() |
3.1 | 66 | [[image:attach:media_1476291758554.png||align="center"]] |
67 | |||
68 | (% style="text-decoration: underline;" %)**To embed a ONEcount Lookup/login form:** | ||
69 | |||
70 | **type: loginlogout** – This choice will embed the lookup/login form for the client of the domain passed. | ||
71 | |||
72 | **formid not required.** | ||
73 | |||
![]() |
4.1 | 74 | (% style="color: rgb(0,0,0);" %)**Example of script to embed a ONEcount Lookup/Login form created under sonish.onecount.net domain:**(%%) |
75 | (% style="color: rgb(0,128,128);" %)**<**(% style="color: rgb(0, 128, 128); color: rgb(0, 128, 128)" %)** **(% style="color: rgb(0, 128, 128); color: rgb(63, 127, 127)" %) script(% style="color: rgb(0, 128, 128); color: rgb(0, 128, 128)" %)> (% style="color: rgb(0, 128, 128); color: rgb(128, 0, 128)" %) | ||
76 | var(% style="color: rgb(0,128,128);" %) (% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0)" %)option =(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0); color: rgb(0, 0, 255)" %){(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 255)" %)'containerid(% style="color: rgb(0,128,128);" %)' (% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0)" %): 'oc-form','(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 255)" %)domain'(% style="color: rgb(0,128,128);" %) (% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0)" %): '[[(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0); color: rgb(0, 0, 0)" %)sonish.onecount.net>>url:http://sonish.onecount.net||shape="rect"]](%%)',(% style="color: rgb(0,128,128);" %)'(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 255)" %)type(% style="color: rgb(0,128,128);" %)'(% style="color: rgb(0, 128, 128); color: rgb(0, 0, 0)" %) (%%): 'loginlogout'} | ||
77 | GCN.embed.form(option); | ||
78 | (% style="color: rgb(51,153,102);" %)</script> | ||
![]() |
3.1 | 79 | |
![]() |
4.1 | 80 | (% style="color: rgb(0, 128, 128); color: rgb(51, 153, 102)" %) |
81 | |||
![]() |
3.1 | 82 | Note: |
83 | You must create a lookup form in Manage Forms and set that form as the lookup form under Config Manager > Mappings > Lookup Form ID in the Config Manager. | ||
84 | |||
![]() |
4.1 | 85 | (% style="text-decoration: underline; color: rgb(0, 64, 128); text-decoration: underline" %)**Lookup Form** |
![]() |
3.1 | 86 | |
87 | [[image:attach:media_1476291817160.png||align="center"]] | ||
88 | |||
89 | This is a lookup form only – there is no login component. User Account Number (ocid) is a required field in this form, and the fields below are determined when creating the lookup form. | ||
90 | |||
91 | (% style="text-decoration: underline;" %)**To embed a ONEcount Lookup form:** | ||
92 | |||
93 | **type: lookup** – This choice will embed the subscriber lookup form for the client of the domain passed. | ||
94 | |||
95 | **formid – optional, not required.** | ||
96 | If the form id is provided in this script, that form will be displayed; if not provided in this script, the system will display the lookup form identified in the Config Manager. | ||
97 | |||
98 | (% style="color: rgb(0,0,0);" %)**Example of script to embed ONEcount lookup form #45 ceated under sonish.onecount.net domain:** | ||
99 | |||
![]() |
4.1 | 100 | (% style="color: rgb(0,0,0);" %)**With Form ID:** |
101 | (% style="color: rgb(0, 0, 0); color: rgb(51, 153, 102)" %)<script>(% style="color: rgb(0,0,0);" %) | ||
102 | (% style="color: rgb(0, 0, 0); color: rgb(128, 0, 128)" %) var(% style="color: rgb(0,0,0);" %) option ={(% style="color: rgb(0, 0, 0); color: rgb(0, 0, 255)" %)'containerId'(% style="color: rgb(0,0,0);" %) : 'oc-form',(% style="color: rgb(0, 0, 0); color: rgb(0, 0, 255)" %)'domain'(% style="color: rgb(0,0,0);" %) : '[[sonish.onecount.net>>url:http://sonish.onecount.net||shape="rect"]]',(% style="color: rgb(0, 0, 0); color: rgb(0, 0, 255)" %)'type'(% style="color: rgb(0,0,0);" %) : 'lookup',(% style="color: rgb(0, 0, 0); color: rgb(0, 0, 255)" %)'formid'(% style="color: rgb(0,0,0);" %) : 45} | ||
103 | GCN.embed.form(option); | ||
104 | (% style="color: rgb(0, 0, 0); color: rgb(51, 153, 102)" %) </script>(% style="color: rgb(0,0,0);" %) | ||
105 | |||
106 | OR | ||
107 | |||
108 | **Without Form ID:** | ||
109 | (% style="color: rgb(0, 0, 0); color: rgb(51, 153, 102)" %)<script>(% style="color: rgb(0,0,0);" %) | ||
110 | (% style="color: rgb(0, 0, 0); color: rgb(128, 0, 128)" %)var(% style="color: rgb(0,0,0);" %) option ={(% style="color: rgb(0, 0, 0); color: rgb(0, 0, 255)" %)'containerId'(% style="color: rgb(0,0,0);" %) : 'oc-form'(% style="color: rgb(0, 0, 0); color: rgb(0, 0, 255)" %),'domain'(% style="color: rgb(0,0,0);" %) : '[[sonish.onecount.net>>url:http://sonish.onecount.net||shape="rect"]]',(% style="color: rgb(0, 0, 0); color: rgb(0, 0, 255)" %)'type'(% style="color: rgb(0,0,0);" %) : 'lookup'} | ||
111 | GCN.embed.form(option); | ||
112 | (% style="color: rgb(0, 0, 0); color: rgb(51, 153, 102)" %) </script> | ||
![]() |
3.1 | 113 | |
114 | Note: | ||
115 | You must create a lookup form in Manage Forms and set that form as the lookup form under Config Manager > Mappings > Lookup Form ID in the Config Manager. | ||
116 | |||
117 | === To style an embedded form: === | ||
118 | |||
119 | [[image:attach:media_1478726466081.png||align="center"]] | ||
120 | |||
![]() |
4.1 | 121 | Click on the "Source" button in the rte of the Custom Header section of the form you're embedding. |
![]() |
3.1 | 122 | |
123 | This will open a pop-up where you can enter html/css to style the form. Be sure to include <style> </style> tags as shown below. | ||
124 | |||
125 | [[image:attach:media_1478726631145.png||align="center"]] | ||
126 | |||
127 | You either create your own css or modify the standard ONEcount form css. Please check your uploaded files in your ONEcount Intranet account for the frontend_form.css document which you can drop between the style tags and modify as needed. If you cannot find this document on the Intranet, please contact ONEcount to obtain it. | ||
128 | |||
129 | |||
130 | |||
131 | {{id name="End ScreenSteps Content"/}} |