Änderungen von Dokument Formular per AJAX einbinden
Änderungskommentar:
Imported from XAR
Zusammenfassung
-
Seiteneigenschaften (3 geändert, 0 hinzugefügt, 0 gelöscht)
Details
- Seiteneigenschaften
-
- Titel
-
... ... @@ -1,1 +1,1 @@ 1 -Formular per AJAXeinbinden1 +$services.localization.render("PT.Main.FormularInWebseiteEinbinden") - Übergeordnete Seite
-
... ... @@ -1,1 +1,1 @@ 1 - WebHome1 +Main.X99Demo - Inhalt
-
... ... @@ -1,5 +1,6 @@ 1 -{{html clean="false"}} <script type="text/javascript" src="https://demo2.formcycle.eu/formcycle/form/includes/010-jquery-min.js?_nc=1601035790902" ></script> 2 -<script type="text/javascript" src="https://demo2.formcycle.eu/formcycle/form/include.js?form_id=564&form_base=https%3A%2F%2Fdemo2.formcycle.eu%2Fformcycle&auto=1&form_container_id=content" ></script> 1 +{{html clean="false"}} 2 + <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 3 + <script src="https://demo.formcycle.eu/formcycle/form/include.js?auto=0&form_container_id=content&form_id=253&form_base=https://demo.formcycle.eu/formcycle"></script> 3 3 4 4 <style type="text/css"> 5 5 pre{ ... ... @@ -31,11 +31,114 @@ 31 31 } 32 32 </style> 33 33 35 + <script> 36 + $.noConflict(); 34 34 38 +window.xima.fc.form.load = (function(options, trigger){ 39 +(function($, options, trigger){ 40 + 41 + var options = options || {}, 42 + o = $.extend({ 43 + loadingImageURL : window.xima.fc.form.loadingImageURL || "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAC4jAAAuIwF4pT92AAABymlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAi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690khkAI5etbKtHjI5AGY1AhPjC/ScG4iLEfkLDug0sKwMzw/8aH3yRbxP4uJllCLwMBVFeMapADXi75Y/Gy017aJL2tkJBIdkenphF/dmrLiS86W46OjewJTnhAIa42U6EZEihBeHbt78lHZUf+8r21oGY7p6T5pWh9+vITs22TykWu6kqmKoyxklVF9MPH6aTpRrO20q8ORCplyfiG5vcuNQAnrGeTjCnYBga+eUQ0GEy0dhesuFdiRqISQ/Pk/xE5sYgO3kcamr6P9gIPLdRve46nYrSC9WqWU+i6pOV+Q3N5zxf4AusodlJW0va8AAAAASUVORK5CYII=", 44 + loadingImageStyle : window.xima.fc.form.loadingImageStyle || ".xm-form-loader-icon { text-align:center; -webkit-animation: spin 0.5s ease-in-out infinite; -moz-animation: spin 0.5s ease-in-out infinite; animation: spin 0.5s ease-in-out infinite;} @-moz-keyframes spin { 100% { -moz-transform: rotateY(360deg); } }@-webkit-keyframes spin { 100% { -webkit-transform: rotateY(360deg); } }@keyframes spin { 100% { -webkit-transform: rotateY(360deg); transform:rotateY(360deg); } }" 45 + },options); 46 + 47 + var d = $.extend({ 48 + "xfc-rp-inline":true, 49 + "xfc-rp-form-only":true, 50 + "xfc-pp-external":true, 51 + "xfc-rp-usejq":false, 52 + "xfc-rp-keepalive":false, 53 + "xfc-rp-usecss":true, 54 + "xfc-rp-useui":true, 55 + "xfc-pp-base-url": o.form_base, 56 + "fcpuid":window.xima.fc.form.fcpuid 57 + }, {"auto":"1","form_id":"253","form_container_id":"content"}, o.data); 58 + 59 + function success(html){ 60 + o.form_container.html(html.replace(/\$/g,'jQuery')); 61 + checkIsLogin(); 62 + } 63 + 64 + function error(data){ 65 + o.form_container.html(data.responseText); 66 + checkIsLogin(); 67 + } 68 + 69 + function renderFromLoginForm(element){ 70 + 71 + var form = element.closest('form'); 72 + pass = $('INPUT[name=pass]', form), 73 + user = $('INPUT[name=user]', form); 74 + 75 + if (user.val() && pass.val()) { 76 + render(user.val(), pass.val()); 77 + } 78 + } 79 + 80 + function checkIsLogin(){ 81 + $('.xfc-template .login INPUT[type=submit]', o.form_container).click(function(){ 82 + renderFromLoginForm($(this)); 83 + return false; 84 + }).addClass('xm-bound-login'); 85 + } 35 35 36 -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"]]. 87 + function buildLoader(){ 88 + o.form_container.html(''); 89 + 90 + var l = $('<div>').addClass('xm-form-loader-icon').appendTo(o.form_container); 91 + $('<style>').text(o.loadingImageStyle).appendTo(l); 92 + $('<img>').attr('src',o.loadingImageURL).appendTo(l); 93 + } 94 + 95 + function render(user, pass){ 96 + d = (user && pass) ? $.extend(d, { 97 + "xfc-rp-username": user, 98 + "xfc-rp-password": pass 99 + }) : d; 100 + 101 + console.log(o.form_base + '/form/provide/' + o.form_id) 102 + 103 + $.ajax($.extend({ 104 + type: "GET", 105 + url: o.form_base + '/form/provide/' + o.form_id, 106 + data: d, 107 + cache: false, 108 + async: false, 109 + beforeSend:buildLoader, 110 + success: success, 111 + crossDomain: true 112 + }, options.ajax )).fail(error); 113 + } 114 + 115 + o.form_id = o.form_id; 116 + o.form_container_id = (o.form_container_id) ? o.form_container_id : 'content'; 117 + o.form_container = (o.form_container_id) ? $('#'+o.form_container_id) : o.form_container; 118 + o.form_container = (o.form_container) ? o.form_container : $('.tx-xm-formcycle, .xfc-template-body').first(); 119 + o.form_base = o.form_base; 120 + if (o.data && o.data.hasOwnProperty("xfc-pp-base-url")) o.form_base = o.data["xfc-pp-base-url"]; 121 + if (o.form_action == 'login') $(renderFromLoginForm(trigger)); else $(render); 122 +})(jQuery, options, trigger)}) 37 37 38 - {{code}} <!DOCTYPE html> 124 +jQuery( document ).ready(function() { 125 +window.xima.fc.form.load({form_container_id:'content', form_base:'https://demo.formcycle.eu/formcycle', form_id:'253'}); 126 +}); 127 + 128 + 129 + 130 + </script> 131 + <style type="text/css"> 132 + span.box{ 133 + display: block; 134 + padding: 20px; 135 + } 136 + </style> 137 +{{/html}} 138 + 139 +Sie können das Formular direkt per AJAX ohne IFrames in Ihre Webseite einbinden. 140 + 141 + {{code html}} 142 + <!DOCTYPE html> 39 39 <html> 40 40 <head> 41 41 <meta charset="utf-8"> ... ... @@ -42,7 +42,7 @@ 42 42 <!-- jQuery must be loaded--> 43 43 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 44 44 <!-- configure path to your server, the id of the content element where the form should placed into and id of the form.--> 45 - <script src="https://demo 2.formcycle.eu/formcycle/form/include.js?auto=1&form_container_id=content&form_id=564&form_base=https://demo2.formcycle.eu/formcycle"></script>149 + <script src="https://demo.formcycle.eu/formcycle/form/include.js?auto=1&form_container_id=content&form_id=253&form_base=https://demo.formcycle.eu/formcycle"></script> 46 46 </head> 47 47 48 48 <body class="body">