callback function after Google Form is submitted - forms

Hi I am embedding a Google Forms in a website, through .
I want to add a callback function to the form, so that I can now that the user submitted it, and I can close the form window (or display a button to close it).
How to do it?
I have not found such a function in GDoc Form. I saw there is a script editor, but could not make it work for me, seems overkill.
I was adding a button to my html page that is always displayed atop of the form, but actually I would like it to appear only after the user completed the form.
--
Edited
Tried iFrame src change event detection?
but still I undergo
Uncaught DOMException: Blocked a frame with origin

Related

How to access input field in TinyMCE 5 URL dialog

I'm porting a TinyMCE 3 installation to version 5. I set up a toolbar button that opens a dialog that contains a custom page and is therefore loaded using the new windowManager.openUrl method. I have some footer buttons, too, and, of course, an onAction( dialogApi, details ) handler that is invoked when a button is clicked. details.name contains the name of the button that was clicked so I can react on every click individually.
It seems, when a regular dialog is used, I configure every input field in my plugin.js file and retrieve its value through the getData method of first param that in passed into my onAction handler. This method does not exist in my dialogApi for the URL dialog.
My iframe/dialog contains a dropdown and I want to insert the selected value into the editor instance when a dialog footer button is clicked. I understand I can use postMessage to send information from the iframe to the plugin but that's not what I want.
How can I access input fields in the dialog, when a button is clicked and my dialog was opened through openUrl? How do I access the document in the dialog's iframe? this seems to be the JavaScript object I passed into openUrl. document is the page where the editor is embedded.
I've made a demo that shows two different ways of getting the data from user inputs in an iframe dialog:
https://codesandbox.io/embed/tinymce-dialog-openurl-demo-fpfew
This blog post is also an excellent resource for working with iframe dialogs in TinyMCE:
https://www.martyfriedel.com/blog/tinymce-5-url-dialog-component-and-window-messaging
The first method in my demo uses a button in the HTML of the iframe itself. That button collects user data and uses postMessage to send that data back to the TinyMCE editor.
As you can see, the process is a little more complex using the footer buttons as opposed to the "in iframe" button. Essentially, the footer button sends a message to the iframe in the dialog asking the iframe to collect and insert user data into TinyMCE.
When using an iframe, you have to respect the browser security policy, so most times you can't interact with an iframe directly (the exception being if the iframe uses the same domain). Here's some more information about iframe security policy:
https://security.stackexchange.com/questions/67889/why-do-browsers-enforce-the-same-origin-security-policy-on-iframes
This also means that TinyMCE has no way of knowing what's inside the iframe like it does with a TinyMCE dialog, so the data needs to be fetched "manually". With that in mind, if it's a cross origin request (different domain) there's no way to access the iframe content without using postMessage.
The getData method mentioned works with TinyMCE dialogs because everything in the dialog is a TinyMCE component. TinyMCE components have a custom concept of values/states that getData can access to return data.
When you use a URL dialog, the dialog no longer uses TinyMCE components so it isn't able to collect the data for getData, hence it the method doesn't exist. That's why you have to manually get the data needed from whatever elements are in the URL dialog, and send them back to TinyMCE using postMessage.

How do I execute a function once a google form is finished inside a webview?

I am using Google Forms in my swift app. The user is supposed to click a button, and then go into a webview to complete the form. The problem is that, once the user completes the form, they are stuck on the finish page. I don't want to add a navigation controller in my app because the user would then be able to skip the form. I am having issues finding ways to make a function that is executed once the form is finished. Any help would be appreciated.
I found way to workaround the issue by providing a link at the end of the google form to finish the form. The webview would then recognize the changed url.

Track form conversions confirmation page URL is the same as the form

I'm trying to track form completions on a page where the form's URL is the same as the confirmation page.
Form Page
Does anybody know if this can be done with Google Tag Manager/Google Analytics please?
Completion page
Simply tracking clicks of the Submit button will result in false positives because sometimes people will not type the security code correctly.
Is there a tracking code of some sort that can be added to the confirmation page, so that each time it loads the count goes up one?
I'm grateful of any help you can provide.
Thanks!
You can use the built-in visibility trigger - e.g. as soon as a link element with the link back to the homepage becomes visible you let the trigger fire. Specifics depend on the CSS id or class for that link (if any, else you'd have to test the click text).
In the visibility trigger you might have to enable "listen for DOM changes" if the confirmation message is loaded per Ajax (as opposed to just have their CSS display property set to 'none'.

How to avoid displaying newsletter form if it is submitted or close once?

I am using mautic form.
I have added form code in my header script and this script always run on every page so how can I avoid to display that form if user close form or he has submitted it before.
Paste the script to the content of your page where you want the form to display. That way it will appear only on the page you want it to show up and on the place you want it to show up.
If you want to display another content after the form submission, configure the after submit redirect URL in the form's configuration.

Visibility change on div with time (Contact Form 7)

I am using WordPress. My contact form plugin is "contact form 7". If your email fails or succeeds, it says sucessfull or not sucessful. I want to attach javascript to it and locate it in middle of my contact so if it fails box opens up says it failed and it disappears, samething for success. I also would like page to change to homepage if mail sent successfully.
If you want this only for the normal use of the form, and not for some fancy special feature - Contact form 7 already have this function .
The default message is (red box ) "Failed to send your message. Please try later or contact the administrator by another method."
you can change this message in the settings.
seems like this could be done pretty easily with jQuery, no? just look for the submit button to be clicked, validate, and then run your actions.
you could either use an alert, or have a hidden div on the page that you change to display:block, throw a timer on that to hide it (or a close button), and just set the html text to 'success' or 'fail' respectively. then when the div is set to close, and was successful, throw a url redirect.
i know that is pretty vague, but not sure of your level of expertise.