Von Version 9.6
bearbeitet von gru
am 05.10.2022, 13:43
Änderungskommentar: Es gibt keinen Kommentar für diese Version
Auf Version 11.12
bearbeitet von gru
am 02.03.2023, 09:22
Änderungskommentar: Es gibt keinen Kommentar für diese Version

Zusammenfassung

Details

Seiteneigenschaften
Titel
... ... @@ -1,1 +1,1 @@
1 -Formular per AJAX einbinden
1 +Formular über externen Kontext einbinden
Inhalt
... ... @@ -1,33 +31,3 @@
1 -{{html clean="false"}}
2 - <style type="text/css">
3 - span.box{
4 - display: block;
5 - padding: 20px;
6 - }
7 - </style>
8 -{{/html}}
9 -
10 -Sie können das Formular direkt per AJAX ohne IFrames in Ihre Webseite einbinden. Unterstützung der möglichen Einbindungsoptionen finde Sie in FORMCYCLE direkt unter [[Veröffentlichen>>doc:Formcycle.UserInterface.MyForms.Publish.WebHome||target="_blank"]].
11 -
12 - {{code}} <!DOCTYPE html>
13 - <html>
14 - <head>
15 - <meta charset="utf-8">
16 - <!-- jQuery must be loaded-->
17 - <script src="https://demo7.formcycle.eu/formcycle/form/includes/010-jquery-min.js?_nc=1637667410192"></script>
18 - <!-- configure path to your server, the id of the content element where the form should placed into and id of the form.-->
19 - <script src="https://demo7.formcycle.eu/formcycle/form/include.js?auto=1&form_container_id=content&form_id=564&form_base=https://demo7.formcycle.eu/formcycle"></script>
20 - </head>
21 -
22 - <body class="body">
23 - <!-- this is the div where the form will be placed into -->
24 - <div id="content"></div>
25 - </body>
26 - </html>
27 - {{/code}}
28 -
29 -Die Einbindung erfolgt hier zur Demonstration in eine eigene HTML-Seite in einem iframe:
30 -
31 31  {{html clean="false"}}
32 32   <style type="text/css">
33 33   pre{
... ... @@ -66,14 +66,85 @@
66 66   margin:0;
67 67   padding:0;
68 68   border:0;
69 - width: 100%;
70 -height: 1000px;
39 + height: inherit;
71 71   }
72 - /*style="width:100%; height:1000px; resize: both; overflow: auto;" */
73 - .ugly { border:4px dashed black; }
41 + .border { border:4px dashed black; }
74 74   </style>
43 +{{/html}}
75 75  
76 - <div class="resizer ugly">
77 - <iframe id="customerdemo" class="resized" src="https://help7.formcycle.eu/xwiki/bin/download/Examples/IncludeAJAX/iframe.html"></iframe>
45 +== 1. Externen Kontext via iFrame einbinden z.B. ==
46 +
47 +[[https://pro.form.cloud/formcycle/external/forms/main.xhtml]]
48 +
49 +TODO: iframe
50 +
51 +== 2. Eventlistener für Formularauswahl registrieren z.B.: ==
52 +
53 +{{code language="javascript"}}
54 +function myFormCycleCallback(msg){
55 + $('#result').html('Nachricht von: "<b>' + msg.origin + '</b>" Formular mit id: "<b>' + msg.data + '</b>" wurde ausgewählt.' );
56 + renderForm(msg.data);
57 +}
58 +
59 +window.addEventListener("message", myFormCycleCallback, false);
60 +{{/code}}
61 +
62 +== 3. Ergebenis speichern: ==
63 +
64 +TODO: Iframe
65 +{{html clean="false"}}
66 + <div class="hljs" id="result"></div>
67 +{{/html}}
68 +
69 +
70 +== 4. Formular einbinden: ==
71 +
72 +{{code language="js"}}
73 +window.renderForm = function(formId){
74 + var myBase = 'https://help7.formcycle.eu/xwiki/bin/view/Examples/IncludeExternalContext/';
75 + var fcBase = 'https://pro.form.cloud/formcycle';
76 + var myFormContainer = $('#content');
77 +
78 + var form = $.ajax({
79 + type: "GET",
80 + url: fcBase + '/form/provide/' + formId,
81 + data:{
82 + //Render-Parameter
83 + "xfc-rp-inline":true, //Verwendete resourcen auflösen
84 + "xfc-rp-form-only":true, //Formular ohne HTML, BODY etc.
85 + "xfc-rp-usejq":false, //jQuery einbinden
86 + "xfc-rp-keepalive":false, //Ping zur Sessionverlängerung
87 + "xfc-rp-usecss":true, //Use Formcycle CSS files
88 + "xfc-rp-useui":true, //jQueryUI einbinden
89 + //Prozess-Parameter
90 + "xfc-pp-external":true, //Externer Formularrequest
91 + "xfc-pp-base-url":fcBase, //URL zum FormCycle
92 + "xfc-pp-success-url": myBase + "/anfrage-versendet.html", //CMS Seite bei erfolg
93 + "xfc-pp-error-url": myBase + "/anfrage-fehler.html" //CMS Seite bei Fehler
94 + },
95 + cache: false,
96 + async: false,
97 + success:function(html){
98 + myFormContainer.html(html);
99 + },
100 + crossDomain: true
101 + });
102 +}
103 +{{/code}}
104 +
105 +
106 +== 5. Ergebenis Formular: ==
107 +
108 +{{html clean="false"}}
109 + <div class="resizer border" style="height: 1000px;">
110 + <iframe id="content" class="resized" src="https://help7.formcycle.eu/xwiki/bin/download/Examples/IncludeAJAX/iframe.html"></iframe>
78 78   </div>
79 79  {{/html}}
113 +
114 +
115 +
116 +
117 +
118 +Hinweis: Aus Kompatibilitätsgründen wird der Inhalt auf dieser Seite in einem iframe dargestellt.
119 +
120 +
iframe.html
Größe
... ... @@ -1,1 +1,1 @@
1 -788 bytes
1 +893 bytes
Inhalt
... ... @@ -6,11 +6,16 @@
6 6   <script src="https://demo7.formcycle.eu/formcycle/form/includes/010-jquery-min.js?_nc=1637667410192"></script>
7 7   <!-- configure path to your server, the id of the content element where the form should placed into and id of the form.-->
8 8   <script src="https://demo7.formcycle.eu/formcycle/form/include.js?auto=1&form_container_id=content&form_id=564&form_base=https://demo7.formcycle.eu/formcycle"></script>
9 + <style>
10 + h1.page, p.page {
11 + text-align: center;
12 + }
13 + </style>
9 9   </head>
10 10  
11 11   <body class="body">
12 - <h1>Beispielwebseite</h1>
13 - <p>Mit dem obenstehenden Code kann ein FORMCYCLE Formular per AJAX in die Website geladen werden.</p>
17 + <h1 class="page">Beispielwebseite</h1>
18 + <p class="page">Mit dem obenstehenden Code kann ein FORMCYCLE Formular per AJAX in die Website geladen werden.</p>
14 14   <!-- this is the div where the form will be placed into -->
15 15   <div id="content"></div>
16 16   </body>