Is it possible to take values of an HTML5 SessionStorage and email it? - email

I'm creating an application with two pages (Page One, Page Two) that have radio buttons on them. The values are stored in sessionStorage and displayed to the user on Page 3. However, I want a Submit button that will take those values in sessionStorage and email it to me (I was planning to use PHP to process and send the email). Can someone help point me in the right direction on how to solve this please?

If you already have a form with your submit button then you could have your javascript insert new inputs of type="hidden", one for each key/value pair. These values will then be submitted with the form so you can process them just like any other POST parameter.

Related

Refresh amp-list content on button click

I have a page that generates random numbers for a user. On page load, it will generate data and I can handle this much with amp-list. What I want is to have a button where the user can generate new data. Think of it like a bingo number generator. Page loads and presents the user with a 6. They want a new number, how can this be done?
I was thinking I could force the page to reload by linking to itself. So the "new number" button would actually just be a url link to the exact same page and this will generate a new number on page load. Using a div with an ID i can provide #randomnumber in the URL and it will go straight to this position.
Im a bit worried about this though as Google might see this as me attempting to inflate viewing numbers to get more ad revenue and what not. Is there a better way to go about this?
You can use changeToLayoutContainer to refresh data in amp-list. Give it an ID and reference that in your on
Example:
<button on="list.changeToLayoutContainer()">Show Grid</button>

How to restrict filling duplicate entry in Google forms

I am working on a Google form where I keep receiving responses every minute. I want to restrict people in case if they are filling the response with the same unique id in column R.
So basically when anyone click on submit button, form should check the values in column R with the value in current form and restrict the user while filling up the form.
I tried doing this in Google form script editor but didn't get the exact code which can validate and stop the user while submitting the form.
Any help will be appreciated. Thanks in advance.
Sanjay
As Zig and Sandy mentioned it is not possible with live forms.
However you have the on submit trigger. You can write your script to look for duplicates of the last record when the form is submitted and in case there is any picks up the email (maybe a required field if they don't have to sign in to fill the form) and let them know their duplicated submit has been removed.

How to update the responses of the google form to the form itself

I am creating a Google Form. I want to insert a count in the end(anywhere,not specific) of the form which will show the number of responses submit till date.This goes like updating the live count. I have tried using script editor for Google Form Add-ons option.But I am unable to view the results automatically or changes. It asks me to accept "Terms of Service" which I don't want to do right now because I am not sure about the way it may result.
There are various options available to view the form results/responses.But here I don't want to view the results later.They should get updated when we click the submit button on form.Please note..simultaneously many users may fill the form.
To implement this,I have thought of logic like whenever submit button gets clicked..the text in the form should get updated.
Please suggest how I can add the count or apply above logic of whenever submit operation is performed. Is it possible?? Any other suggestions are welcomed..Thanks in Advance!!!
I found another possible way of doing this..I received all the responses in Google Spreadsheet..which I later embedded in my site. Solves the purpose..And the embedded data gets updated automatically for the responses !! Cheers

How do I make a link that pre-fills a form checkbox?

I have a page called contact.htm with a working form. One of the checkbox fields on the form is named Garden (so either it is checked or not when using the form).
I have another page that I want to link to my form page, so that if a user clicks a particular link, they are sent to the form page and the field Garden is pre-clicked.
I have not been able to do this though I have tried several methods...such as:
a href="contact.htm?checkbox=Garden,on" or
a href="contact.htm?checkbox=Garden,checked" or
a href="contact.htm?input type="checkbox" name="Garden" value="checked", and some others.
I would appreciate any help.
You'll need to use JavaScript on the target webpage to process the argument and fill the values in. There is no automatic way of doing this just by URL.
This link shows how to retrieve URL arguments from JavaScript. From there, it's a matter of using standard JavaScript or JQuery to fill the values in.

Submitting multiple forms from a single view

Using CakePHP I have a page where I have multiple forms. Each form updates a single field on a record. I'm trying to implement a way to submit all the forms through a single "Submit All" button. However, all my solutions so far have been lest than successful.
My first attempt was to create a separate action called editAll in the controller that took an array, but I cannot figure out how to send the data from all the forms to that action without having a hidden form that saves all that data. The second idea was to create some kind of Javascript function that iterated over all the forms to create an array to be sent to the controller's editAll action.
The first implementation did not work, and I couldn't find a reasonable way to implement the second idea.
Basically, I was hoping someone could point me in the direction to submitting multiple forms (or at least the data from multiple forms) at once from a single page.
I assume you don't ALWAYS want to submit them all - if you do, then just make one form. If you're hoping to be able to submit some of them individually, but also be able to submit them all, then you could do something along the lines of this:
Keep all the fields in one form. For each field have a 'submitted' value (1 or 0). If they click the Submit next to an individual field, turn all of the submitted values to 0 except that one, then submit the form.
If they click Submit All, then turn them all to '1' and submit the form.
Then, when you process the data, just strip anything that doesn't have 'submitted' value of 1.
It would still take some work, and you're submitting more data than is necessary, but.... it's an idea.