Google Sheet create a hyperlink() like function to open Pop Up message - javascript

In Google Sheet, I like to create a general JS/GS function similar to the Hyperlink() function so that I can quickly create a Pop Up message without creating so many JS script.
While we can create all kinds of AppScript function that accept a text variable as the pop up content, the challenge is that we cannot trigger it unless we create some kind of buttons or add a menu option. Both adding button is cumbersome to create and it is not conveniently sized and fixed within a cell. If I have many of such pop up messages across the sheet, it will be pretty difficult to create so many buttons. I have searched all over the net and cannot even find someone asking a similar question not to mention a solution.
The most efficient way is a function which is similar to the hyperlink() function where I can just add the contents of the Pop Up dialog box. I can image the product will be something like the mock up image below.
Please help.
enter image description here

You can use an onEdit() trigger to show the alert. Inside this onEdit() you can set the conditions you want to be applied and set multiple alerts to show.
It is not a ton of code if you want to keep it simple.

Related

Can I create dynamic menu items using a form popup?

Would it be possible to use a popup form to handle parameters for a custom menu item in a spreadsheet? I'm not necessarily asking for someone to write the script. I just don't want to try only to discover I've been wasting my time.
In my spreadsheet, I want to be able to save a sheet to a new file/spreadsheet (that part is done) and then access/load that saved sheet again later through a custom menu command. The issue I'm running into is that I want to be able to call the same function every time, but be able to specify a parameter (which sheet to access). My thought is that the form would act like an alert with multiple choices populated by the array of available sheets.
Or is there a simpler way to offer a multiple choice without going through a series of YES/NO alerts?
Yes. You can use dialogs.
modeless dialogs
modal dialogs
Dialog Example

Dynamically display database information onclick

I set up a web service using LAMP for personal use.
Basically, I have a scrollable list with some database information I pull once in the PHP script. I'd like to be able to click on one of the items, and have more information appear in a preview pane . (preview pane is set up)
I don't expect to ever have more than 100 entries in my database. Also, the data I'm pulling is very small...about 10 fields, all text data.
My question is as follows:
If I pull all the data I need in one shot, how can I store it so that each block of data I define (2-3 rows are what I need in the preview pane) is "cached" and I can access that given block at will so I can display it upon clicking its corresponding list entry?
Basically, this is about the same as clicking an email in a web-browser and having the rest of the message show up in a preview pane.
Thanks.
nb: the fact that I'm using a preview pane or a list is irrelevant. Just describing what I'm doing.
If I understand correctly, you would like to create a simple page, where several details are hidden until you click on different buttons. If you would like to do this in a "cached" way, you can try the following:
Fetch the complete data so that everything (with details) ends up in the result HTML. Everything: I mean, the parts which should be visible at all times and also the details which should be visible only after pressing a button.
Now, to the design. You will have to write CSS code, which will hide the details. (Of course, for that, you will have to create HTML in step 1 which will let you target the details via CSS classes, for example.) You will also have to figure out how to create buttons.
The most complicated part is to bind the buttons to Javascript actions, which will perform showing the hidden details. You can control all CSS properties from Javascript, so for example you can alter the position, the size, the text color etc. of a <div> dynamically.
Most people nowadays use jQuery for tasks like the one in step 3, or even software libraries built on the top of jQuery. That could help a lot if you're just starting out with tasks like this one. On the jQuery site, you will find a great place to start, called the jQuery Learning Center.
Edit: I've created a very basic fiddle to let you test the JS part of my concept, see it here: http://jsfiddle.net/eL9mj/22/

Display Image on mouse-on hover

I am having this application where I need to have something like, when we bring the mouse over an employee's name, which is an actionlink , it is suppose to show the employee's image.
I am trying to do so using MVC, but am till far unable to do so.
Please can anyone help me out in this..
Thanks in advance for help.
This is a JavaScript thing, not an ASP.NET MVC thing. You'll take one of two approaches:
Put the image on page at load, but give it a class or otherwise style it to be hidden initially. Then you'll just need to add an JS event handler for the mouseover event of your links that will cause the image to display.
Again, you'll use a JS event handler tied to the mouseover event of your links, but you send an AJAX request for the image URL and then dynamically insert the image into the page based on the response. This is kind of overkill for something this simple though.
#1 is really the best way to go for this use case, and there's probably around 10 million articles, blog posts, tutorials, etc. online regarding hiding and showing content based on a JS event. Google your heart out.

Tooltip image on cell hover, Google Spreadsheet

I'm currently working on a Google Spreadsheet that has to include a bunch of image references.
What I want to achieve is this: When you hover over a cell an image appear (like a tooltip).
I found this widget on the Google Developers, but when I add the code to my spreadsheet nothing happens.
Does any of you guys know how to do something like this? Any hints on how to go about this is highly appreciated!
Displaying a User Interface from a Spreadsheet
As an alternative to deploying your user interface as a standalone web app, you can create a container-bound script from a Spreadsheet, and display the user interface from the Spreadsheet. To do this, find your doGet function and simply replace the call to
return app;
with the following:
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
spreadsheet.show(app);
where app is the variable name for the UiInstance object you are returning. Additionally, when you display the user interface from a Spreadsheet, the function does not have to be named doGet. You could instead call it something like displayMyUi, and then call that function directly to display the user interface in your Spreadsheet. When a user interface is displayed from a Spreadsheet, the script runs as the user who's accessing the Spreadsheet.
e.g.
function doGet() {
var app = UiApp.createApplication();
// The very first Google Doodle!
app.add(app.createImage("http://www.google.com/logos/googleburn.jpg"));
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
spreadsheet.show(app);
}
What you are wanting to do is not possible in a Google Spreadsheet, widgets are only available in UiApp or HTML service.
What should be doable is to recreate the spreadsheet display in a Ui and from there use some kind of popup with a mouseOver handler to show the images as you want.
Depending of your use case - mainly on what spreadsheet specific features you want to have when looking at your data - this could be a good or bad solution but only you can answer this last point.
So probably not the cleanest solution, but you can add links to a cell, and when you add a link to an image from your google drive (probably you should make the image avaiable to all with the link) then on mouseover you get a tooltip like box, with preview

How to choose a specific thumbnail photo on like button

I have a webpage i keep adding a like button app to but whenever i click like i get some random member phot of a lady on facebook representing my page. this is frustrating.
I find all this html script and i cant seem to put it together properly so will you just please give me a simple paste ready like button formula with a set specific thumbnail photo that I can choose to represent my own page?
Use the open graph properties for your webpage defined here:
http://developers.facebook.com/docs/opengraph/

Categories

Resources