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
[SOLVED]Item Selector button is disabled
Massimo Bevilacqua, modified 5 Years ago.
Regular Member
Posts: 210
Join Date: 12/27/16
Recent Posts
I have followed the tutorial in this page about Item Selector
https://portal.liferay.dev/docs/7-0/tutorials/-/knowledge_base/t/selecting-entities-using-the-item-selector
After some adjustment it works, but now I have a problem, the "add" button inside the Item selector is disabled and the code inside the "selectedItemChange" function is never called.
I just need to select a file and the get the name(or title) of the file.
Someone knows how to do it?
https://portal.liferay.dev/docs/7-0/tutorials/-/knowledge_base/t/selecting-entities-using-the-item-selector
After some adjustment it works, but now I have a problem, the "add" button inside the Item selector is disabled and the code inside the "selectedItemChange" function is never called.
I just need to select a file and the get the name(or title) of the file.
Someone knows how to do it?
Hey Massimo,
I don't have a lot of experience with the item selector stuff (just haven't gotten around to it yet) but I am happy to troubleshoot with you. Can you share some code? and maybe shed some light on some of the "adjustments" you made to make it work?
My first thought as to why the button is disabled is, of course, permissions related -- but that's just a stab in the dark.
I don't have a lot of experience with the item selector stuff (just haven't gotten around to it yet) but I am happy to troubleshoot with you. Can you share some code? and maybe shed some light on some of the "adjustments" you made to make it work?
My first thought as to why the button is disabled is, of course, permissions related -- but that's just a stab in the dark.
Massimo Bevilacqua, modified 5 Years ago.
Regular Member
Posts: 210
Join Date: 12/27/16
Recent Posts
Hi Andrew,
thank for the reply.
In th end I have found the problem.
In the tutorial there is in the java part:
and in the JSP code:
The event name must be the same written in the java code, in this example "sampleTestSelectItem" and not "ItemSelectedEventName". Using the same name in both it works.
I always found Liferay tutorials and documentation very confusing
thank for the reply.
In th end I have found the problem.
In the tutorial there is in the java part:
PortletURL itemSelectorURL = _itemSelector.getItemSelectorURL(
requestBackedPortletURLFactory, "sampleTestSelectItem",
imageItemSelectorCriterion);and in the JSP code:
<aui:script use="liferay-item-selector-dialog">
$('#<portlet:namespace />chooseImage').on(
'click',
function(event) {
var itemSelectorDialog = new A.LiferayItemSelectorDialog(
{
eventName: 'ItemSelectedEventName',
on: {...</aui:script>The event name must be the same written in the java code, in this example "sampleTestSelectItem" and not "ItemSelectedEventName". Using the same name in both it works.
I always found Liferay tutorials and documentation very confusing