How to use CeateEvent with a UIApp application created with GAS - google-apps-script

Using Google Apps ScriptI created a panel with a submitbutton and an anchor .
If the user clicks on the button I want to activate the anchor and perform its actions as if it has been clicked itself.
So I thought generating a mouseclick on the anchor by CreateEvent would be sufficient.
But I can't find a way to generate that clickevent.
How can I do that(or achieve my goal differently) ?

You'll want to just assign the same client / server handlers that the anchor has to the submit button. Try a regular button instead of submit if a form isn't involved. Can't create a mouse click event through code either.

Related

How to show the upload file dialog on page load

Using PF10 (in a JoinFaces project), I'd like the Upload File dialog for choosing a file to show up when the page loads (i.e., without waiting for the user to click on the Choose button of <p:fileUpload/>). How can I do that?
You could use client side API show() function for this. But it seems more and more browsers are blocking triggering a click by script on an input type="file". See https://github.com/primefaces/primefaces/issues/7772
You could take your chances and try to hijack a mouse move event to trigger a click on the upload input, which is answered on this question: In JavaScript can I make a "click" event fire programmatically for a file input element? But I don't really like that hack.

How to click a button in angular 2?

Without involving Jquery, how can the javascript of a component click an HTML button? All the documentation is for the opposite interaction of a button being on the page and handling that click, which won't work because it belongs to a ngNoForm element that the browser needs to handle itself.
You can just use a normal javascript click
Here is the doc
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click
Here is an example code
document.getElementById( "exit-cancel" ).querySelector( "a" ).click()

vba in html- Need to onmouseup login which is not a button

Is it possible to automate a login page using vba which has a mousedown and mouseup clicks . When i click a login button it has a mousedown click as it doesn't have any button in order to automate using vba.
Please let me know if its possible to do so in vba using some functions
Please copy the URL and paste in internet tab: "http://discovery.ariba.com/rfx/3796429". After clicking the URL you will enter to Ariba Discovery site and there you have this Ship to Service location field. In that ship to service location field there are multiple locations and we need to click on "Show more". To click show more if we see the html code it's not a button in order to automate the click. It's awmouseup and aw is the page name i guess. I would recommend you yo use google chrome and try inspecting the html code. I need to automate the click using VBA code.
ie.document.getElementById("_sbsyf").click
should do it

Open Help web page from Google script HTMLservice interface

I want to put a Help button on an HTMLservice interface. I have tried it directly on the button and also by calling the function below
function helpClicked() {
document.getElementById('payment').value = "Help Clicked...";
window.open("www.google.com")
}
This changes the payment field to validate that the button was clicked but does not open a new browser window with the url. Is there any way to make this happen?
Use a link (a tag) directly with the correct URL instead of a button and use css to make it look like a button (if you need one). You can still hook triggers to the link, but you won't need to do the window.open yourself, therefore avoiding this problem/limitation.

Direct to another URL using a server side handler

I am looking for a way to navigate to a URL using a button in my Google Apps Script UiApp. I have added an on click server handler to the button, and once the event is triggered I would like to navigate to a different URL.
Is there a way I can do this in a server side handler ?
Many thanks
Relax_Im_A_Quant there is no way to have a server handler send the user to another URL. They have to click on a link.
However, there is a way to achieve similar results and may suit your needs.
You can add, remove and change the visibility of the elements in your UiApp.
For example, have a search box that starts visible and a results panel that starts not visible. When the server handler is called the search box is changed to not visible, the results panel changed to visible and the results are added to the results panel. You can turn off the visibility of a whole panel and turn on the visibility of a another.
In one of my apps that creates a document for the user, it would add a link to the document to the UiApp and then make it visible when the 'create document' button was pressed. It would prompt the user to click the link after it appeared -- taking them to the document (a new URL).