Embedding a form and posting it to another site - javascript

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.

Related

Is there some way to simulate keyboard input or setting the input value WITHOUT using javascript element.value?

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.

Prepopulate a Google Form using ID without using emails

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.

add "onload click on <a> function" to a link send by email

I was wondering if there is a way to add to the link sent by email a code or something to make the landing page click on a link.
Let me explain:
I have a product page that includes a review button (the link), and the emails sent by the hosting only includes a link to the product page. So, when the user click on it, they go to the product page, then the user have to go down to the "add a review" button and click on it to be able to write the review. So, my idea is to find a way to add an extra coding to the emailed link, that make the product page "click" on the link on this page to load the review form when the page loads.
I have been trying to modify the code to make it more friendly for users, but the ASP coding of the hosting (no accessible from my side) is not allowing me to do many things...
If you want specific client side behaviour when coming from the mail, you have to have a different url. If you won't make a separate page, you can add a fragment like #review and either have a direct anchor on the page so client is just scrolled there or you can check the fragment on load and make a click/scroll/navigation however you need using javascript.

Setting a popup to only appear if the user hasn't submitted the form in the popup

I'm not sure how best to approach this, but this project would require a popup to appear. The popup would display an iframe that has a donation form linked to an external database. Ideally, this popup would only appear if the visitor has not yet donated.
Since I don't have direct access to this external database (form is provided by the client), I thought, maybe, the popup could utilize HTML localStorage (found a working demo here) taking it a step further to check if that form had been submitted (storing info from the form action?) for that visitor. This stored cookie would then expire every 6 months.
Is this even possible or is there a better way to accomplish this?

generating pop up on another page when form is submitted?

i have 2 pages in jsp. 1 is doctor.jsp and the other is patient.jsp. Both pages are open in 2 different pc and have different views. what i want to do is that when patient form is submitted the patient.jsp is refreshed but data of form move to doctor page and a pop-up of div is generated in doctor.jsp. but the patient view remains as it is and just a pop-up is generated in doctor.jsp.
For pushing information to a page using jquery check out the Atmosphere framework. You'll need both server and client side code to handle the transactions, and Atmosphere can make it a lot easier. I haven't used it in regular jsp but perhaps this article is a good starting point for you.

Categories

Resources