Foros de discusión

Checkboxes in liferay

thumbnail
Kalai arasan, modificado hace 10 años.

Checkboxes in liferay

Regular Member Mensajes: 127 Fecha de incorporación: 2/01/13 Mensajes recientes
Hi! I am new to liferay. i wants to use checkboxes in search container. Please tell me how to use checkboxes in liferay search container.
thumbnail
jaid shaik, modificado hace 10 años.

RE: Checkboxes in liferay

Regular Member Mensajes: 171 Fecha de incorporación: 8/10/10 Mensajes recientes
Hi Kalai arasan,


  <liferay-ui:search-container-column-text>
                          <input type="checkbox" id="selectArticleCheckBox" class="selectArticleCheckBox" name="selectArticleCheckBox" value="<%= journalArticle.getArticleId() %">        
                        </liferay-ui:search-container-column-text>



I think the above code helps you, please check and let me know.




Thanks
Jaid.shaik
thumbnail
Kalai arasan, modificado hace 10 años.

RE: Checkboxes in liferay

Regular Member Mensajes: 127 Fecha de incorporación: 2/01/13 Mensajes recientes
Hi. Your code is working. But i wants to print the selected checkbox value t. is it possible.
thumbnail
Prakash Khanchandani, modificado hace 10 años.

RE: Checkboxes in liferay

Expert Mensajes: 329 Fecha de incorporación: 10/02/11 Mensajes recientes
There are three ways, the first two are self explanatory and straight-forward.

1) using simple html <input type="checkbox"> as:
<liferay-ui:search-container-column-text>
     <input type="checkbox" id="myCheckBoxIds" name="myCheckBoxes" value="<%= myObject.getMyId() %>">       
</liferay-ui:search-container-column-text>

2) using aui tag for checkbox as:
<liferay-ui:search-container-column-text>
    <aui:input cssClass="myCheckboxesStyle" label="" name="myCheckBoxes" type="checkbox" value="<%= myObject.getMyId() %>" />
</liferay-ui:search-container-column-text>

3) using rowChecker in searchContainer which automatically generates the checkboxes on the left side like in document library as:
<liferay-ui:search-container rowchecker="<%= new RowChecker(renderResponse) %>"></liferay-ui:search-container>

This generates the input-checkbox element and also generates some javascript. You can find out how this is used in Liferay by checking the source for:
1) /portal-ee-6.1-ga2/portal-web/docroot/html/portlet/document_library_display/view_file_entries.jspf
2) /portal-ee-6.1-ga2/portal-web/docroot/html/portlet/blogs_admin/view.jsp
3) /portal-ee-6.1-ga2/portal-web/docroot/html/portlet/journal/view.jsp
4) /portal-ee-6.1-ga2/portal-web/docroot/html/portlet/wiki/page_iterator.jsp

Hope this helps.
thumbnail
Kalai arasan, modificado hace 10 años.

RE: Checkboxes in liferay

Regular Member Mensajes: 127 Fecha de incorporación: 2/01/13 Mensajes recientes
I wants to print the values which are selected in liferay. Is it help me or not?
thumbnail
Raja Nagendra Kumar, modificado hace 10 años.

RE: Checkboxes in liferay

Expert Mensajes: 484 Fecha de incorporación: 2/03/06 Mensajes recientes
If want the print to happen in server side use jsp syntax

<%
System.out.println("hi..');
%>

http://www.coderanch.com/t/293160/JSP/java/view-System-print-hai-jsp

else, use javascript alert

http://stackoverflow.com/questions/2080279/how-to-call-alert-box-using-jsp

Regards,
Raja Nagendra Kumar,
www.tejasoft.com
-Java Code Quality Engineering
thumbnail
mohammad azaruddin, modificado hace 10 años.

RE: Checkboxes in liferay

Expert Mensajes: 492 Fecha de incorporación: 17/09/12 Mensajes recientes
Hi Prakash Khanchandani

I'm using Rowchecker for search container..So by default i want to check all checkbox ...How can i achive this...?.apart from make it checked on load via script
thumbnail
ahad bahmanian, modificado hace 10 años.

RE: Checkboxes in liferay

New Member Mensajes: 8 Fecha de incorporación: 7/11/12 Mensajes recientes
hi,
if i use chechbox in searchcontiner, how i return id for selected chechbox?
--------------------------------------------------------------------------------------------------------------------------
<script type="text/javascript">
function showBoxes(frm) {
var message = "Your chose:\n\n"

for (i = 0; i < frm.Music.length; i++)
if (frm.Music.checked) {
message = message + frm.Music.value + "\n"
}

alert(message)
}
</script>
....

<liferay-ui:search-container emptyResultsMessage="there-are-no-PorseshNameh" delta="10">
<liferay-ui:search-container-results>
<%
List<Answer> tempResults = ActionUtil.getAnswerByQuestion(porseshnamehData.get(pRadif).getQuestionId());
results = ListUtil.subList(
tempResults, searchContainer.getStart(),
searchContainer.getEnd());
total = tempResults.size();
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total);
%>
</liferay-ui:search-container-results>

<liferay-ui:search-container-row
className="com.internet.afkar.model.Answer"
keyProperty="answerId" modelVar="answer">

<portlet:actionURL name="readUserSelection" var="readUserSelectionURL">
<portlet:param name="resourcePrimKey"
value="<%=String.valueOf(answer.getPrimaryKey()) %>"/>
</portlet:actionURL>

<liferay-ui:search-container-column-text>
<input type="checkbox" name="Music" value="<%= String.valueOf(answer.getPrimaryKey()) %>" onclick=""/>
</liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="#"
value="<%=Integer.toString(searchContainer.getStart()+(++i))%>"/>
<liferay-ui:search-container-column-text name="answer-pasokh" property="pasokh"
href="<%=readUserSelectionURL.toString()%>"/>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator/>
</liferay-ui:search-container>

.....

<INPUT TYPE="Button" VALUE="Tell Us What You Like!" onClick="showBoxes(this.form)">
thumbnail
mohammad azaruddin, modificado hace 10 años.

RE: Checkboxes in liferay

Expert Mensajes: 492 Fecha de incorporación: 17/09/12 Mensajes recientes
try this