私は自分のサイト上のSQLデータベースにドキュメントのURLを送ることができるGoogleドキュメント用のウェブアプリケーションを作成しています。サイドバーを用意して、現在のドキュメントのURLを含む非表示の入力フォームにユーザー名とパスワードを入力してみましょう。サイドバーのコンテンツを変更する
私は隠された入力をすべて受け入れることができました。私は、サイドバーのHTMLページから関数を実行する方法を知っています。私の問題は機能の中にある...私は何かのようなものがあることを願っていますdocument.sidebar.getUi().getElementById('URLinput').value = "the url";
私はURLを取得する方法を知っています。私は、サイドバーの 'ボディ'を編集する方法を知らない。
これは私のコードは、これまでのところです:
var doc = DocumentApp.getActiveDocument();
var link = doc.getUrl();
function addUrl() { //I have no idea how to do this part...
var html = HtmlService.createHtmlOutput('page');
DocumentApp.getUi().showSidebar(html);
}
function onOpen() {
DocumentApp.getUi() // Or DocumentApp or FormApp.
.createMenu('Timklein')
.addItem('Show sidebar', 'showSidebar')
.addToUi();
}
function showSidebar() {
var html = HtmlService.createHtmlOutputFromFile('page')
.setTitle('My custom sidebar')
.setWidth(700);
DocumentApp.getUi() // Or DocumentApp or FormApp.
.showSidebar(html);
}
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<h1>Timklein.tk webapp</h1>
<form action="mysite.com/adddoc.php" method="POST">
<b>add to database...</b>
<br>username:
<input type="text" name="username">
<br>password:
<input type="password" name="password">
<br>Naam van het document:
<input type="text" size="2" name="docName">
<br>
<input type="hidden" name="docLink" id="URLinput">
<input type="submit" name="submit" value="send">
</form>
<script>
google.script.run.doSomething();
</script>
</body>
</html>
任意のヘルプは非常に高く評価されるだろう!
ありがとうございます!