i have the following elements on in some url
<div class="col-sm-10">
<select id="geniee_adserverbundle_zone_masterIabCategory" name="geniee_adserverbundle_zone[masterIabCategory]" class="form-control master-category-tier1"><option value="1" selected="selected">Arts & Entertainment</option><option value="2">Automotive</option><option value="3">Business</option><option value="4">Careers</option><option value="5">Education</option><option value="6">Family & Parenting</option><option value="7">Health & Fitness</option><option value="8">Food & Drink</option><option value="9">Hobbies & Interests</option><option value="10">Home & Garden</option><option value="11">Law, Gov't & Politics</option><option value="12">News</option><option value="13">Personal Finance</option><option value="14">Society</option><option value="15">Science</option><option value="16">Pets</option><option value="17">Sports</option><option value="18">Style & Fashion</option><option value="19">Technology & Computing</option><option value="20">Travel</option><option value="21">Real Estate</option><option value="22">Shopping</option><option value="23">Religion & Spirituality</option><option value="24">Uncategorized</option><option value="25">Adult Content</option><option value="26">Illegal Content</option></select>
</div>
i want to get the selected option from the mentioned combobox above. which is Arts & Entertainment
i tried the following formula, and it's not working
=IMPORTxml(L72,"//select[#id='geniee_adserverbundle_zone_masterIabCategory']//option[#selected='selected']")
please note that L72 is a cell where my friends input the specified url.
what i want to do is, when my friends update the URL, google sheet update its cell automatically.
is there anything wrong with my formula or the page prohibit me from scraping their data ?
update : the page is not public, you have to logged in first to get the access. but my account is currently logged in,and when i open the URL, browser redirect me to specified page which contains the mentioned elements.
IMPORTXML only works on public pages. One alternative is to use the URL Fetch service.
Related
I know it's possible to display a Google Sheet as HTML using the spreadsheet ID and GID, i.e.:
https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/gviz/tq?tqx=out:html&tq&gid=GID
But in order to view that, you have to know the URL of the sheet. What I'm wondering is whether it's possible to display this HTML version of the sheet but without revealing the URL of the sheet?
Manually
To retrieve a Spreadsheet in HTML format you can export it accordingly by clicking on File -> Download -> Web Page. That will get you a zip file with the HTML of your Spreadsheet that you can rename as you like without revealing the Spreadsheet ID.
With Apps Script
You can also automate this process creating an Apps Script function that for instance gets triggered every time you click on an inserted button (to do this you can simply click on the menu bar Insert -> Drawing and the on the three dots of the top right of this button click on assign script and set it to the name of your function).
The following function will display a modal dialog on the Spreadsheet when run that if the user clicks on Download it will automatically download the zip file with the Spreadsheet in HMTL format. This function has self explanatory comments :
function downloadHTML() {
// Get ID of the Spreadsheet
var id = SpreadsheetApp.getActive().getId();
// Get the download URL of this Spreadshet in format HTML on the background
var url = "https://docs.google.com/a/mydomain.org/spreadsheets/d/" + id + "/export?exportFormat=zip&access_token=" + ScriptApp.getOAuthToken();
// Download when clicked on the button of the opened dialog
var html = '<input type="button" value="Download" onClick="location.href=\'' + url + '\'" >';
// create an HTML output from the given string
var dialog = HtmlService.createHtmlOutput(html);
// Show a modal dialog on the Spreadsheet UI when the function is run with the Title download
SpreadsheetApp.getUi().showModalDialog(dialog, "Download");
}
Reference
createHTMLOutput
showModalDialog
I've been working on this for a couple on days, and I can't find any answer to this issue.
I don't have a programmer background, so it might be an easy question for some of you.
The issue:
I have 5 Google Forms that fill 5 different Sheets in 1 Master Google Sheet.
--> When Google Form 1 is filled, there is a new line in sheet1
--> When Google Form 2 is filled, there is a new line in sheet2
--> When Google Form 3 is filled, there is a new line in sheet3
--> When Google Form 4 is filled, there is a new line in sheet4
--> When Google Form 5 is filled, there is a new line in sheet5
Now, I would need to be able to run some script (different ones) when a new line is added to each sheets.
The idea is:
--> When a new line is added to sheet1, do this.
--> When a new line is added to sheet2, do this.
.
.
.
I tried something like this (see below). But it doesn't return anything since there is no "Activesheet" when the google form is filled and add a new row by himself to Google sheet.
function onChange(event) {
var s = event.source.getActiveSheet();
var sName = s.getName();
Browser.msgBox(sName);
}
Question:
In other words, do you have a idea about how I can get the sheet that was edited by the google form, so that I can run specific script for each sheet when it gets modified ?
the onChange trigger does not fire on form submission, use the FormSubmit trigger instead
The related event objects are specified here.
The event object source is not available, but instead you can use the event object range in combination with getSheet().
Sample:
function onChange(event) {
var s = event.range.getSheet();
var sName = s.getName();
Browser.msgBox(sName);
}
I am making an app using ionic framework -v1, now i found out when deploying my app to IOS the app seems to works perfectly fine at first.
But when i enter a space (using the mobile number keypad) in my input=[number] field the app starts flickering and loses the scopes with the space in them. Later when i want to push my data to angularfire it also completely stops working and wont let me push my data.
My input is as simple as this:
<input type="number" name="" ng-model="info.DriversLicensenr">
My customer would like the field to have spaces in them, but also the numbers keypad should show up when pressed in the app.
Is there any way to allow spaces? or to modify another input type to reach the desired effect?
This kind of input will open a number pad on mobile device. However, you will have to check that the user doesn't type other caracters than numbers.
<input type="text" inputmode="numeric" ng-model="ctrl.dLicence"/>
EDIT
<input type="text" pattern="[0-9\s]*"/>
This opens a number pad, but doesn't limit to numbers only.
No that's not possible i will suggest you to use input type text and then use ng-pattern to validate it is number or not. This won't stop you from inserting characters but will show error it there's a character or any other special characters.
To restrict input to only numbers or space , use below code
<input type="text" inputmode="numeric" oninput="formatNumber(event)"/>
function formatNumber(event){
let value = event.target.value || '';
value = value.replace(/[^0-9 ]/,'');
event.target.value = value;
}
I am using the following code in the fusion tables 'customize info window' to create hyperlinked URL's from a column in my table:
"{URL}"
This works fine in returning the clickable hyperlink in the info box except fusion maps by default tacks on https: instead of http: when the link is clicked. This causes problems when the user clicks the hyperlink and it tries to take them to a secure site when in fact it is not secure. The browsers throw up all sorts of warnings that will scare the pants off a lot of users who don't know what is happening.
Does anybody know how to remedy this and have the default be http and not the current https?
Thanks, Shep
You may want to abandon the "{URL}" approach and display the hyperlink with some simple HTML. This example from Google shows how to modify the info window's HTML in Javascript:
google.maps.event.addListener(layer, 'click', function(e) {
// Change the content of the InfoWindow
e.infoWindowHtml = e.row['Store Name'].value + "<br>";
// If the delivery == yes, add content to the window
if (e.row['delivery'].value == 'yes') {
e.infoWindowHtml += "Delivers!";
}
});
Changing the e.row['Store Name'] to your URL column name (maybe, e.row['URL']) and surrounding by a couple of hyperlink tags <a> should do the trick:
e.infoWindowHtml = "<a href='" + e.row['URL'].value + "'>Click here!</a>";
There are three ways:
Specify a full URL including protocol in your data
Use Link here in a custom info window layout
Completely override the content as in the answer above
I would recommend #1 because you can choose the right protocol for every link. However #2 is probably easier in that you can leave your data the way it is.
I have 3 typeahead fields:
They are as follows:
Country: |___________|
State: |___________|
City: |___________|
Here is the code for the second typeahead field (the rest are similar):
<input type="text" class="span3" style="margin: 0 auto;"
data-provide="typeahead" data-items="4"
data-source="["Alabama","Alaska",
<many more US states>
,"Wyoming"]">
Now ... I need both typeahead fields to look like dropdowns which can be achieved by following instructions here.. no problem.
https://github.com/danielfarrell/bootstrap-combobox
http://dl.dropbox.com/u/21368/bootstrap-combobox/index.html
The question I'm asking pertains to the "Last Option" below:
Note: I am building this in Rails, so ruby code would be nice...
Placeholder Case:
I need each of the drop down lists to have a default placeholder text which is grayed out.
eg:
Country: |_USA_______|
State: |_IOWA______|
City: |_DES MOINES____|
Missing Value Case:
If the user types in a City value that does not exist in the autocomplete, I want to show them a dropdown with a link..
eg: User types in "yahoo" in City field. This should result in the output "That city does not exist, click here to search for it"
Clicking on the above text should redirect me to Google.com
Error Case:
If nothing is selected in the first field (country).. the second field should have a default value in the dropdown: "Please select a Country to begin"
Last Option:
upon successful selection of a City, eg: San Francisco ... I want to make a redirect to a new html file like "mysite.com/datastore/calsan.html" (first three letters from each selection in lowercase appended together)
this final html file will be pre-generated and will have relevant statistics and fun facts about the city "San Francisco"... I'll also have fun facts for other cities pregenerated in the datastore folder.
See my snippets below
Placeholder case
<script type="text/javascript">
$(document).ready(function(){
$('.combobox').combobox({placeholder: "Type Something.."});
});
</script>
Last Option
<script type="text/javascript">
$('.combobox').change(function(){
if($(this).val().length > 0){
var fileName = $(this).val().substr(0,3); // this is for getting the first 3 characters, apply the same logic wherever necessary
window.location("/datastrore/" + fileName + ".html");
}
})
</script>
Last Option
There seems to be a simple way to do this with inline javascript and option value. I think I will be using this simpler way..
http://webdesign.about.com/od/javascript/f/blfaqddredirect.htm
Placeholder Case and All other Cases
http://harvesthq.github.com/chosen/
The above library solves all my issues and is very powerful! Its not for bootstrap but I don't mind until bootstrap has a comparable option.