Is there a way to use a variable in Google Scripts HTML Code? Right now I have:
var activeUser = Session.getActiveUser()
app.add(app.createHTML("<h1>Hello, activeUser </h1>"));
This doesn't work. Is there a way to make this work? Thanks!
Do you mean something like this?
var activeUser = Session.getActiveUser()
app.add(app.createHTML("<h1>Hello, " + activeUser + "</h1>"));
Related
I am trying to archive very simple things but I'm not getting the expected result from the below script. I don't know what im going wrong.
<script>
var APP = "APPR";// in properties file APPR = Approved
var message = "#{props["APP"]}";// JSF EL expression with resourcebundle
alert(message)// Want to print "Approved" but its printing ??APP???
</script>
Im using JSF resourcebundle and javascript.
try below
#{props['"+ APP + "']}
I am trying to give a link from my php page. But its showing an error. Is the following script correct? Can anyone help me pls? Its an annotation problem. Some where i have not put the annotation correctly?
window.open('add_new_shipment.php?tender_id='+result["tender_id"]&
id='+result["id"], 'quotation', 'scrollbars=yes', 'menubar=no', 'status=no', 'width=800, height=600');
Missing + ' Plus sign and single quote
window.open('add_new_shipment.php?tender_id='+result["tender_id"] +'&id='+result["id"], 'quotation', 'scrollbars=yes', 'menubar=no', 'status=no', 'width=800, height=600');
------^
var result = 50;
var id = 4;
window.open('add_new_shipment.php?tender_id='+result+'&'+'id='+id+',quotation,scrollbars=yes,menubar=no,status=no,width=800,height=600');
});
if you are using php in create url then use this script
window.open('add_new_shipment.php?tender_id=&id=,quotation,scrollbars=yes,menubar=no,status=no,width=800,height=600');
});
I'm new to AngularJS and I'm trying to retrieve an image link from Google Firebase that is put in a scope variable. This works when I perform the retrieval of the URL in an action using a different controller before this one loads it. However, when retrieving it in this controller, my div somehow doesn't want to display the image. I've checked with a simple ng-bind whether the scope variable is updated, and it is. However, the picture div in the view stays empty. Does anyone know how I can get my view to display the image?
Controller:
$scope.profilepicture = null;
var storageRef = firebase.storage().ref();
var path = "profilepictures/" + userFactory.getUser().uid + "/profilepicture";
var profilePicRef = storageRef.child(path);
profilePicRef.getDownloadURL().then(function(url) {
$scope.$apply(function(){
$scope.profilepicture = url;
});
}).catch(function(error) {
});
View:
<div ng-click="getImage()" ng-style="{'background-image' : 'url({{profilepicture}})'}" style="width:100px; etc...></div>
ng-style="{'background-image' : 'url(' + profilepicture + ')'}"
I've just found the issue. The ng-style url needed to be written like this: ' + value + '
Thanks for your help :)
Try like this by removing braces from there, but just make sure you are getting a right value of profilepicture.
<div ng-click="getImage()" ng-style="{'background-image' : 'url(profilepicture)'}" style="width:100px; etc...></div>
I'm using thymeleaf in my spring boot project. It's working well. Now I need to render one url in JavaScript as a string and need to concatenate with one JavaScript variable. I have tried the following code.
location.href = /*[[#{/signage/save}]]*/ '' + res.id
But the generated output is
location.href='/signage/save';
What I want is following
location.href = '/signage/save' + res.id;
How can I achieve it?
You can tell Thymeleaf to uncomment certain code if the page is served dynamically using special comment syntax /*[+...+]*/. And inside this commented block, you can put expressions and they will be evaluated together with the whole block.
/*[+ location.href = [[#{/signage/save}]] + res.id +]*/
Will be rendered as
location.href = '/signage/save' + res.id
After trying few methods got the solution, not exactly what I needed but it works for me. I just wrapped it using parenthesis ((.....))
location.href = (/*[[#{/signage/save}]]*/ '') + res.id
and generated output is
location.href = ('/signage/save') + res.id;
I am sending an email via javascript. In mail.parameter.text property I need to send the hyperlink. In the code below I am hardcoding the url whick looks very lengthy and also I need to add the /dashboard at the end of the url. Any idea on how to shorten the url?
var parent = space.getParent();
var siteGroup = "GROUP_EMAIL_CONTRIBUTORS";
var mail = actions.create("mail");
mail.parameters.to_many = siteGroup;
mail.parameters.subject="New Site Created in Community"
mail.parameters.text=" A new site called " + document.properties.name +"is created.Click http://pc1:8080/share/page/site/"+document.properties.name+"/dashboard"+" to join the site";
//execute action against a document
mail.execute(document);
Sorry if this is a basic question I dont know javascript. This is my entire script and I am not using any html tags in between.
You can change it to something like this, for example:
mail.parameters.text="Click <a href='http://pc1:8080/share/page/site/" + document.properties.name + "/dashboard'>here</a>";
Your link will appear as "here" and nevertheless lead to the URL you specified. Is that what you mean by "shorten the url"?
Please try now.
var url = "Click http://pc1:8080/share/page/site/" + document.properties.name + "/dashboard" + " to join the site";
ail.parameters.text = url;