Capture text input in Google Web Designer expandable banner - javascript

I'm creating an expandable banner with Google Web Designer and I want to allow the user to type their name/email in to a textbox and to capture the value to report in the campaign.
Going to the Tag tool I created an input field and dragged it to the page. When I preview I can type text in there, but I can't raise any events and it doesn't log anything to the console.
How can I capture the users input? I thought it would be easy as it supports HTML5, but I can't see how to wire up my input field

There is no built-in functionality for accomplishing anything with form inputs since GWD is intended to be used to create ads for Google's Ad Network which does not support any interaction other than clicks. However, you can use Javascript just like you would if you weren't using Google Web Designer.
You would just give the input an ID and create a button to grab the value of the input and then you could do whatever you want with it.
For example, if you added an input with the ID of name and a button with the ID of button you would add this in your Code view within the gwd-init-code script tags:
document.getElementById("button").onclick = function() {
var inputVal = document.getElementById("name").value;
alert(inputVal);
};

Related

Image Submission Form with Element Tags on Wordpress

I am trying to create a form on Wordpress where users can submit an image and then select different parts of the image, and a corresponding text field will appear on the side where the user will start typing the name of the element and predetermined Categories/Tags on my site will start being autosuggested. I am trying to create a list of all of the elements in the image by allowing the user to point to a part of the image and then type the element into a text field and the text field should autosuggest Categories/Tags that are already in my site.
I am looking at Gravity Forms to create the autosuggest text field but I am lost when it comes to the image tagging function. I am trying to use/integrate plugins to create this form function.
Any plugin suggestions? I appreciate the help. Thanks!

JavaScript dummy/proxy input for another DOM element

I'm using an iframe to get the content of a registration form on a web page, and, as I have to show this registration form inside an HTML app for Android, I'd like to analyse the html inside the iframe to search for input textfields and to use my custom text field as "dummy" or "proxy" for the considered element:
Let me explain better:
As the web page wouldn't give the user the same easy approach as an app, instead of clicking on a textfield and having the problem that the virtual keyboard overlaps the other fields making it difficult to go further.
I want to create a div that covers the iframe and has a text field inside with the same functionality as the one clicked: by this way after entering the text into the dummy field and clicking an ok button aside, the clicked field would be updated and all the other things hidden (virtual keyboard, etc.).
It would be simple if the goal was just to copy a text from a field to another, but the real problem is that the clicked field could have some events like onkeypress or onchange (e.g. to autocomplete) and so on, and I should get the same behaviour on the dummy field.
In an imaginary world I'd do:
document.getElementById("dummy") = document.getElementById("original")
And then destroying and recreating the dummy whenever required.
Do you know if is there something possible to do?
You can't read a div from inside of an iframe after the iframe has loaded. The reason for this is to prevent hackers from making programs that can grab your credit card numbers from web-based forms through iframes and then use the apps to record them.
UPDATE
You would have to retrieve the entire form in the background, then render it again using webkit, then when the person clicks submit, you would have to submit the exact same form data to the host from your device.
Its possible, but I don't see a good reason why you would ever need to use that.

Access Text Field & Button of any webpage with java

I would like to access any input element on webpage with the help of java.
For example:- lets user has opened any website which contains 2text field & 1 text area and submit button.
So what I want is that, all that field should get typed by my java programs.
I have speech to text converter and it works fine.
So what I want is that if user open a site T would like to type some content then by speaking it self that content should get types on the web page.
Say for example,
Post on facebook.
Search friend on facebook.
Querying text on google without query string, means text must get types on browser and user must realize that text is getting typed as he is speaking.
It is a wrong approach to use java or javascript here, you need to modify the browser itself, for example you can check
https://wiki.mozilla.org/SpeechAPI

Scraping a dynamically generated webpage with HTML5 <input> field

I want to collect data from this page. I have keywords I want to input in the search box, which is defined as an HTML5 <input> with an eventlistener that dynamically changes the page based on the query.
For example, I want a script that inputs the term "hello world" in the search field and then scrapes the dynamically generated content, say the name of the collections that appear. Because of the Same Origin Policy I can't use JavaScript and I've spent the last 3 hours looking into Python but couldn't find anything there.
I can't tell if this is so obvious no one writes/asks about it, or it's a clever way to not let scripts scrape from your site.
Open the page in Chrome's Debugger or Firebug in Firefox and look at the Network Tab and find out the AJAX requests the JavaScript is doing when you enter text into the input field(s).
Then write a webscraper using any of:
https://pypi.python.org/pypi/requests
https://pypi.python.org/pypi/spyda
https://pypi.python.org/pypi/scrapy

how to inject text into a textbox with firefox extension

This question was probably asked few time by now... but I didn't find any solution in the last 2 days so I'm asking it in here.
I need to inject some text into a textbox that has an ID and I already know it. the scenario is like that:
The user insert a text into the textbox inside my toolbar.
The user clicks on a button in my toolar.
The function in the button should redirect the user to a new page in the background, inject a text into a specified textbox and click a button in that webpage.
Return a link that is generated on the webpage.
I know how to open a new webpage. now all is left is the rest.
I can't seem to inject the text into the specified textbox.
Also to note, I can't use greasemonkey on this project and that's why I will have to write everything I'll need to write.
If you can direct me to the starting point for this problem it would be nice.
The textbox is XUL textbox or html textarea?
It look like your scenario is simulate submit a form in background, why not just directly create a XMLHttpRequest to do this, no need to interactive with UI.
Update:
If it is a XUL textbox, you can use value property
var textbox = window.document.getElementById(textboxId);
if (textbox) {
textbox.value = 'your text';
}

Categories

Resources