Fórum

Checkboxes in liferay

thumbnail
Kalai arasan, modificado 10 Anos atrás.

Checkboxes in liferay

Regular Member Postagens: 127 Data de Entrada: 02/01/13 Postagens Recentes
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 10 Anos atrás.

RE: Checkboxes in liferay

Regular Member Postagens: 171 Data de Entrada: 08/10/10 Postagens Recentes
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 10 Anos atrás.

RE: Checkboxes in liferay

Regular Member Postagens: 127 Data de Entrada: 02/01/13 Postagens Recentes
Hi. Your code is working. But i wants to print the selected checkbox value t. is it possible.
thumbnail
Prakash Khanchandani, modificado 10 Anos atrás.

RE: Checkboxes in liferay

Expert Postagens: 329 Data de Entrada: 10/02/11 Postagens Recentes
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 10 Anos atrás.

RE: Checkboxes in liferay

Regular Member Postagens: 127 Data de Entrada: 02/01/13 Postagens Recentes
I wants to print the values which are selected in liferay. Is it help me or not?
thumbnail
Raja Nagendra Kumar, modificado 10 Anos atrás.

RE: Checkboxes in liferay

Expert Postagens: 484 Data de Entrada: 02/03/06 Postagens Recentes
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 10 Anos atrás.

RE: Checkboxes in liferay

Expert Postagens: 492 Data de Entrada: 17/09/12 Postagens Recentes
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 10 Anos atrás.

RE: Checkboxes in liferay

New Member Postagens: 8 Data de Entrada: 07/11/12 Postagens Recentes
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 10 Anos atrás.

RE: Checkboxes in liferay

Expert Postagens: 492 Data de Entrada: 17/09/12 Postagens Recentes
try this