Here's my situation. I have a long list of students (each student with an ID); and each student have their own preferences on food, and games, ... (all of these data are stored on a Google Spreadsheet). I'd like to confirm all the students that the info are all correct.
I can do this by sending each student with a prefilled-link a Google Form, then after they edit, and hit submit, I'll scan and update the spreadsheet, and resend them the new link with pre-filled information that they've just editted.
However, I find it to be a little bit 'messy' (? I'm not exactly sure if this is the right word, as they have to check their emails, click on the link, and when they need to modify their data yet again, they have to find the newest email sent by me, and click on the new link).
I wonder if this can be solved just by using only Google Form (or maybe by embedding a Google Form inside another page?)? I'm thinking off creating 2 Google Forms:
One form for the students to enter their ID, and when they hit submit they'll be taken to the second Google Form with their newest info (fetched from the spreadsheet) pre-filled for them.
The second form is the form filled with their previously-entered information.
Since Google App Script will not allowed me to redirect the users to some other website (including, other Google Forms?) upon form submission, so I'm thinking of embedding the ID Google Form into my site on Google Site.
Here's my pretty bad embedding:
<!-- Normal form embed code, add an ID -->
<iframe id="gform" src="https://docs.google.com/forms/d/e/MyFirstFormURL/viewform?embedded=true" width="640" height="700" frameborder="0" marginheight="0" marginwidth="0" style="margin:0 auto; max-width:100%;">Loading…</iframe>
<script type="text/javascript">
var load = 0;
document.getElementById('gform').onload = function(){
/*Execute on every reload on iFrame*/
load++;
if(load == 2){
/*Second reload is a submit*/
document.location = "https://docs.google.com/forms/d/e/MySecondFormURL/viewform?embedded=true";
}
}
</script>
But I run into 2 problems (or maybe 3 problems):
I use onload event for the iframe to check whether the form has already been submitted; which is bad, since it will still direct me to the second page even when I hit "Clear Form".
I cannot read the ID the student provided inside the Google Form embedded in iframe. :(
Even if I can somehow read the ID in my Google Form, I have no way to externally perform a search on my spreadsheet to get the desired pre-filled link (it must be done by GAS back-end, right?)
I have some basic knowledge in programming (like a tad C, and C++; but I have very little (next to nothing) experience when it comes to web-development), I just list out everything that I have thought about, and worked on in this post. :(
Can someone give me a push? :(
Thank you so much in advance, :*
There's a variety of ways this can be done, but here's what I would use. The major advantage of this approach is that it wouldn't require any app script coding.
Rather than email a direct link to a form, I would send the students a link to a webpage that is actually a google spreadsheet (example here --Feel free to submit test data on the form).
Make sure to link the form's responses to appear in the same spreadsheet and then use an index and Counta function (see below) to get the respective latest answers to appears as I did in cells b3 and c3 in screenshot below. These latest answers can be embedded in the link to the form shown in cell A3 which ensures that the spreadsheet will always have a link to the latest submission.
Note if you want to give your students a link to the actual spreadsheet, that would be a little less browser compatible but offers instant updates to the updated form link, whereas a webpage refreshes every 5 minutes.
Good luck.
Related
I know this is confusing and difficult because I have not code to show. Thats part of the problem, I dont really understand what is happening and I came here for some ideas.
In my job employees need to connect to two online systems.
The first one is programmed by me. Basically employees need to put some login credentials to enter our internal system to see their calendar, tasks, etc. Everything is good until here
The second system is a CRM site provided from an external providor. Users need to login into that system and the login credentials ARE THE SAME than the first system we have. We are loading this secondary page as an iframe inside the first system.
Considering our users already filled a login/password page I would like to fill automaticaly the second login form with the data we already have.
The problem is that somehow the login form of the CRM have some sort of validation system and if I use javascript to paste the login/password the "login button" remains disabled. The value is there and I can see it in the input field. That button only validates if an user fills the value with the keyboard or paste from the clipboard.
That is all I have at the moment and I dont know how to continue. Is there any way to simulate keyboard input or to ask the page to validate the content of the field? Any idea will be very appreciated.
I have a list of URLs and some info on a Google Sheet and managed to open the URLs with a Google Apps Script. On the page that opens, there are 2 input fields and a confirm button. I need the script to get info from the spreadsheet (which I saved as variables) and input them into these fields. After that, I need the script to click on the submit button.
I'm not entirely sure this would be the solution, but I figured I would need to get the input field element by id and then insert the variable in it. But I wasn't able to do it because getElementById() doesn't work with Google Apps Script.
I did quite some digging and only found solutions that used the HTML file on a Google Apps Script. However, I don't know if it would help solve this issue and I honestly didn't understand much of it. I guess it would only add unnecessary steps since I already managed to open the page on another tab.
I have the ID of the first input field. The second field is one "Tab hit" away from the first one and has a dynamic ID, so it won't work when I loop the script to do it with all the URLs. The only property that seems unique to it is the aria-label (I don't know if it helps). The submit button doesn't have an ID but it has a unique class and a type="submit" (I can see it on inspect but not when I open the source code on another page, don't know if there's a difference).
I already managed to open the URLs on another tab and save the info on variables, now I'm stuck on the step that inserts them on the input fields and clicks the submit button.
Here's my code so far:
function fulfill() {
var rangeValues = searchRange.getValues();
var orderId = rangeValues[604][1];
var trackingNumber = rangeValues[604][3];
var shippingCompany = rangeValues[604][4];
var url = "https://someshopifystore.myshopify.com/admin/orders/" + orderId + "/fulfill_and_ship?fulfill_only=true&fulfillment_service_handle=manual&location_id=2085355564&requires_shipping=true";
var html = "<script>window.open('" + url + "');google.script.host.close();</script>";
var userInterface = HtmlService.createHtmlOutput(html);
SpreadsheetApp.getUi().showModalDialog(userInterface, 'Open Tab');
}
OBS1: I need to solve it through Google Sheets and Google Apps Script because it's part of a wider solution.
OBS2: The page that opens is a fulfillment page from Shopify.
If you do want to solve to implement your functionality with Google Apps Script, here some basic key points:
Have a look at the reference and guides for the usage of Apps Script HTML
service.
Bounding an HTML file to your script allows you to embed Javascript code within the <script> </script> part of a HTML file.
This is where you can use functions that are not supported by Apps Script (e.g. getElementById()).
To call an Apps Script function from the JS part, you can use the google.script.run method.
To set values to HTML input fields manually, you need to access those elements, e.g. by their ID or name. You need to inspect the source code of your URL to see how those input fields have been defined and can be identified. Subsequently you have to trigger a submit event.
If you use the Shopify API instead, you can bypass the creation of HTML file with JS script. All you have to do is to chose the right API (e.g. RESTful API to create an order), copy the JSON request (adapting it to your needs) and post the request with UrlFetchApp.fetch() - with the order request as payload within the request options.
Had a question around forms and posting data to other web sites. The website in question has a donation form I would like to utilize - and they are serving as a fiscal sponsor for a company I work for. Currently we have to link to their form and guide our users on how to donate through them. I want to embed their form on our site so as to skip the step of linking to their form and make it easier on our users.
I first started with simply copying their forms' HTML verbatim but when I click the submit button to submit a donation, it takes me to their "cart" page and there is nothing in the cart.
So I'm not sure what else to try
The cart refers to an object in session. Simply copying the HTML will not enable the add to cart of other site.
In this case must redirect the user to other site. Or you can use an iframe for embedding the other page in your site.
Google calendar invite emails will update after they are sent if the original event has been changed... how does Google achieve this? Is there a general technique for anyone to do this? Or is this only possible because Google owns both gMail/gCalendar and the two systems are integrated behind the scenes outside of SMTP?
My first guess was that they used an iframe or an image that was loaded when the email was opened, but inspecting the source of the gMail page doesn't show any signs of that.
Here's a screenshot of the updated text:
And here's the HTML for that section of the page when reading the email within gMail:
Note :
Inspecting Source wil give you nothing other than the markup of the content you see in the page after all dynamic operations including ajax.
To check the actual source, you want to visit view-source:url.
Now the question
That information is updated automatically at Run time via a JavaScript code.
In the image, you checked on Inspect element, which show the code of live view and so, you saw the updated content.
It is done by JavaScript DOM and text manipulation.
To verify this,
Click on the address bar.
add view-source: before the url. So, it will look like view-source:https://url
Then press ctrl+f or the corresponding key to find.
Search for the <div id=":8hg" which will show 0 results.
The view-source is load the source of the file without any ajax or JavaScript manipulation.
The div is not present in the source. So, we can understand that it is done dynamically.
When checking in detail,
in the source, we can see a link https://www.google.com/calendar/event?action\u003dVIEW\u0026eid\u003db..... which is stored in an array.
From this link, the content is taken.
(I blacked out some text for privacy).
Based on the return of the url, the content on mail is upated.
To verify this,
In the mail, you can see This invitation is out of date
But in the view-source: page, search for This invitation is out of date and it will return 0 results.
So, it is sure that the Calendar details are taken via an API call by Gmail to the G Calendar API.
I wonder if on sending the email they create an image at some url and then if it changes they just remove it, then in the email they have something like
<div id="updated"></div>
<img src="asdfawe" onerror="document.getElementById('updated').innerhtml="some text""/>
Although im not sure if they can't use the onerror attribute (b/c email + js = bad idea). the only other way is just to use alt attribute and use some css trickery but I don't see how that could result in the inspected code.
Thanks for taking a look at this. My task at hand is to put a html page in qualtrics, as an iframe (is the current thinking), and from that to see if I can get user data through event tracking to be sent to Google Analytics. So far, I understand how to send events to GA, and I'm working on the Custom Dimensions, but I have to wait a day to see if that's worked.
What I need though, is a unique ID, which I generate with qualtric's random number generator php. I need this unique ID to be sent to Google Analytics so that I can identify who's doing what on the embedded page. So I've looked at the Qualtrics javascript stuff, and I can get qualtrics itself to generate the id through javascript:
<script language="javascript">
var user = '${e://Field/user}';
document.write (user);
</script>
This works to just display the number in Qualtrics, but I know I'm missing a huge step, because implementing the same thing in an embedded webpage won't work - will it? I've tried, without success, and I've even used the
Qualtrics.SurveyEngine.addOnload(function()
{});
without success.
If you have any suggestions, that would keep the user in Qualtrics, but pass the embedded data for a unique individual's user events on an embedded webpage to GA, I'm all ears. Any reconceptualizing is cool to.
I'm just trying to figure out who is doing what on my embedded pages (iframed webpages) in Qualtrics.
Maybe this source will help: http://ut1.qualtrics.com/WRAPI/QuestionAPI/classes/Qualtrics%20JavaScript%20Question%20API.html
Thank you very much for any advice or direction.