Search code examples
javascriptjqueryjspliferayliferay-6

Unable to enable checkboxes for non admin users in JSP, liferay


I am using liferay 6. I have a view.jsp

<% for(int i=8; i<typeNotification.size(); i++) { %>
    <li><input style="margin:5px;" 
               name="preferencesIds" 
               type="checkbox" 
               <%= announcementsPrefTypes.contains(NotificationType.getEmailType(typeNotification.get(i))) ? "checked" : "" %> 
               value="<%= NotificationType.getEmailType(typeNotification.get(i))%>" 
        />
       <b><%=NotificationType.getTypeNotification(typeNotification.get(i)) %></b>
    </li>
<% } %>

The problem is if the user is not Admin the checkboxes are all disabled. When I inspect the element in the browser, I see disabled="disabled", even though there is no disabled attribute.

I tried searching my entire workspace if the name attribute is used anywhere, but only in this jsp file the name preferencesIds is used.

I am also not able to overwrite the disabled attribute with disabled="<%= isAdminUser%>". isAdminUser returns false, which does not work. But if I log in as Admin then disabled="<%= isAdminUser%>" becomes true.

My leader says maybe there is a javascript which manipulates this checkbox's behaviour. I cannot find it, if there is one. Any idea how to override or find out what logic is causing this?


Solution

  • Will I found out that in the view.jsp there is a jsp code which redirects to another jsp file where the logic for checkboxes being disabled or not is written. Modifying the logic enabled the checkboxes.