Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: portlet:resourceURL parameters with Javascript
Hello,
how i can populate the "fileId" parameter value
with the value passed when i call the function downloadFile?
function downloadFile(fileIdValue)
{
location = '<portlet:resourceurl><portlet:param name="fileId" value="fileIdValue" /></portlet:resourceurl>';
}
fileIdValue is your request parameter?
If so, scriptlet can help in this.
Else if this will be javascript value only, you may need to have initial resource url available as js variable (say downloadResUrl) and append the parameter to that in javascript scope only.
If so, scriptlet can help in this.
Else if this will be javascript value only, you may need to have initial resource url available as js variable (say downloadResUrl) and append the parameter to that in javascript scope only.
function downloadFile(fileIdValue)
{
var downloadResUrl = '<portlet:resourceurl></portlet:resourceurl>';
location = Liferay.Util.addParams("fileId="+fileIdValue, downloadResUrl);
}
Tanks fot the support Yogesh Sharma.I've implemented it and now my code is more clean =)
This is my actual code now:
function downloadFile(fileIdValue)
{
var downloadResUrl = '<portlet:resourceURL></portlet:resourceURL>';
location = Liferay.Util.addParams("fileId="+fileIdValue, downloadResUrl);
return false;
}
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™