Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
gaitt
Experienced
Topic Author
Posts: 46
Joined: 21 Nov 2010, 12:48

Integrate a GForm

09 Aug 2018, 09:48

Hi Karl, 

I'd like to integrate a GForm in a x3 page, the easy way is to use a iframe but it not convenient. 

Then I found this tool : http://stefano.brilli.me/google-forms-html-exporter/ which convert the GForm to a standard form and the integration in x3 is smooth even in a mobile phone. 
The problem is the JS script does not seems to be called in x3! 

Can you help with that? The JS code seems to be a hack to get the notification of the post!
Also since I added the JS code, I get this kind of weird display : screenshot

Thanks
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Integrate a GForm

10 Aug 2018, 03:04

Ok, well I would need link to the page with gform and login to your panel to take a look. I must admit, I am skeptical for the following reasons:
  • You are right, "iframe" is not "nice", but since it retains the full form/style/code in a separate website page, you can be sure it will work and will display as intended from the original form.
  • When including the form directly in the page, your form will be inheriting X3 form styles. This could be good, but it can also cause some unexpected results.
  • As for the JS code you are referring to, I don't even know what that is for or why it's required. Is it JS for the exporter plugin or what I wonder.
  • In your case, you have pasted the JS literally into the content. You would at least need to surround it by <script></script> tags.
 
User avatar
gaitt
Experienced
Topic Author
Posts: 46
Joined: 21 Nov 2010, 12:48

Re: Integrate a GForm

10 Aug 2018, 05:50

I think the JS is here to intercept the submit of the form in order to show an alert and redirect to somewhere! 

The page content contains only the form. The JS code is in custom JS section of the panel.
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Integrate a GForm

10 Aug 2018, 06:13

Ok, well I have adjusted the scripts so that it works from X3's side at least.

See in your settings > custom > custom JS, I have assigned the script to run on x3 page load, AFTER jquery is loaded. Furthermore, the script will only trigger if the bootstrapform element exists on page.

I tried to fill the form, and it seems to work properly from X3's side. In the console, I see a "404" error for the docs.google url ... but reading the comments for this script, that seems to be how it's supposed to work.
Image
 
User avatar
gaitt
Experienced
Topic Author
Posts: 46
Joined: 21 Nov 2010, 12:48

Re: Integrate a GForm

10 Aug 2018, 06:29

Perfect, it works like a charm!! 

I set the window.location to a hidden thankyou page. Redirection works and the linked form google sheet it properly filled.