forked from OHDSI/ShinyDeploy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwidgets.R
28 lines (28 loc) · 1.23 KB
/
widgets.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
searchButton <- function(inputId, label, structured) {
if (structured) {
script <- "
var link = document.createElement('a');
link.id = 'searchLink';
link.href = '?structured=true'
// link.href = link.href + '&indication=' + encodeURI(document.getElementById('indication').value);
link.href = link.href + '&exposureGroup=' + encodeURI(document.getElementById('exposureGroup').value);
link.href = link.href + '&target=' + encodeURI(document.getElementById('target').value);
link.href = link.href + '&comparator=' + encodeURI(document.getElementById('comparator').value);
link.href = link.href + '&outcome=' + encodeURI(document.getElementById('outcome').value);
link.href = link.href + '&database=' + encodeURI(document.getElementById('database').value);
document.body.appendChild(link);
document.getElementById('searchLink').click();
return false;
"
} else {
script <- "
var link = document.createElement('a');
link.id = 'searchLink';
link.href = '?term=' + encodeURI(document.getElementById('query').value);
document.body.appendChild(link);
document.getElementById('searchLink').click();
return false;
"
}
tags$button(type = "button", onclick = script, label)
}