Forums de discussion

How to use liferay-ui:input-move-boxes ??

jam dah, modifié il y a 9 années.

How to use liferay-ui:input-move-boxes ??

Junior Member Publications: 43 Date d'inscription: 13/08/14 Publications récentes
Hi every body,
I am newer in fileray portal. I want to user input-move-boxes in my portlet.
I have difficulty to retreive data from input-move-boxes.
In the leftBox, i have many items, i want to choose 2 or 3 items, so in the rightBox i will have those items as i choose.
The problem is that i can retreive only the last one.
the view.jsp:
<%  
	      List leftBox = new ArrayList(), rightBox = new ArrayList();  
    	  leftBox.add(new KeyValuePair("channel1", "Channel1"));
	      leftBox.add(new KeyValuePair("channel2", "Channel2"));  
	      leftBox.add(new KeyValuePair("channel3", "Channel3"));  
	      leftBox.add(new KeyValuePair("channel4", "Channel4"));  
	      leftBox.add(new KeyValuePair("channel5", "Channel5"));
	      
	     %>  
      <liferay-ui:input-move-boxes leftBoxName="leftBox" leftTitle="Available channels" leftList="<%=leftBox%>" leftReorder="true" rightBoxName="rightBox" rightTitle="Selected channels" rightList="<%=rightBox%>" rightReorder="true" />   

In my processAction method, i try this code
String[] rightBox = ParamUtil.getParameterValues(actionRequest, "rightBox");

System.out.println(rightBox.length);
the result is 1 always.
Please, how can i retreive all the data from teh right box?
thumbnail
Pankaj Kathiriya, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Liferay Master Publications: 722 Date d'inscription: 05/08/10 Publications récentes
The items on right box should be selected, then only you will get all records from rightbox.
jam dah, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Junior Member Publications: 43 Date d'inscription: 13/08/14 Publications récentes
thanks for you reply
then only you will get all records from rightbox.

how can i recover all records ?
thumbnail
Mayur Patel, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Expert Publications: 358 Date d'inscription: 17/11/10 Publications récentes
Hi Jam,

Please refer this blog.

Thanks.
jam dah, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Junior Member Publications: 43 Date d'inscription: 13/08/14 Publications récentes
thanks for your reply, but it didn't work
look what i did:
view.jsp
&lt;%
/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */
%&gt;

&lt;%@ include file="/init.jsp" %&gt;
&lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt;

<portlet:defineobjects />
<portlet:actionurl var="distURL">
    <portlet:param name="mvcPath" value="/view.jsp" />
</portlet:actionurl>

<aui:form name="fm" action="<%= distURL %>" method="post">
      	
      <aui:select name="selectPlayer" label="Select a Player">
    		<aui:option value="player1"> Player1</aui:option>
            <aui:option value="player2"> Player2</aui:option>
            <aui:option value="player3"> Player3</aui:option>
            <aui:option value="player4"> Player4</aui:option>
            <aui:option value="player5"> Player5</aui:option>
            <aui:option value="player6"> Player6</aui:option>
     </aui:select>	

    	&lt;%  
	      List leftBox = new ArrayList(), rightBox = new ArrayList();  
    	  leftBox.add(new KeyValuePair("channel1", "Channel1"));
	      leftBox.add(new KeyValuePair("channel2", "Channel2"));  
	      leftBox.add(new KeyValuePair("channel3", "Channel3"));  
	      leftBox.add(new KeyValuePair("channel4", "Channel4"));  
	      leftBox.add(new KeyValuePair("channel5", "Channel5"));
	      
	     %&gt;  
      <liferay-ui:input-move-boxes leftBoxName="leftBox" leftTitle="Available channels" leftList="<%=leftBox%>" leftReorder="true" rightBoxName="rightBox" rightTitle="Selected channels" rightList="<%=rightBox%>" rightReorder="true" />   
    	
	 <aui:input type="hidden" name="hiddenRightFields" />

     <center><aui:button type="submit" value="Valider" onclick="<portlet:namespace />submitForm();" cssClass=".submitButton" /> </center> 	
</aui:form>

<aui:script>
Liferay.provide(
window,
'<portlet:namespace />submitForm',
function() {
document.fm.<portlet:namespace />hiddenRightFields.value = Liferay.Util.listSelect(document.fm.<portlet:namespace />rightBox); 
document.fm.submit();

}, ['liferay-util-list-fields']
);
</aui:script>


my process action
package com.amms.portlets; 

import java.io.IOException;
import java.util.List;
import java.io.File;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.xpath.XPathExpressionException;

import org.xml.sax.SAXException;

import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.repository.model.FileEntry;
import com.liferay.portal.kernel.util.KeyValuePair;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.model.PortletPreferences;
import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
import com.netcenter.tools.NetcenterTools;
import com.netcenter.tools.ParserXml;


public class DistrbutionPortlet extends MVCPortlet{

	 @Override
	    public void processAction(
	        ActionRequest actionRequest, ActionResponse actionResponse)
	        throws IOException, PortletException {
		 
	        String selectPlayer = ParamUtil.getString(actionRequest, "selectPlayer");
	        //String[] rightBox = ParamUtil.getParameterValues(actionRequest, "rightBox");
	        String rightBox = ParamUtil.getString(actionRequest, "rightBox");
	        //String toList = ListingUtils.toggleCamelCaseWords(ParamUtil.getString(actionRequest,"hiddenLeftFields"), false);
	        String toList = ParamUtil.getString(actionRequest, "hiddenRightFields"); 
	  	        
	        System.out.println("-------------------Parameters--------------------"+toList);
	        System.out.println("-------------------------------------------------");
	        System.out.println(selectPlayer);
	        System.out.println(rightBox);
	        
	       
	        
	        ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
	        if((selectPlayer != null)&amp;&amp;(rightBox != null))
	        {
	        	FileEntry fileEntry;
				try {
					fileEntry = DLAppServiceUtil.getFileEntry(themeDisplay.getLayout().getGroupId(), 0, "Distribution");
					String pathFileDestion = NetcenterTools.getDLFileAbsPath(fileEntry);
		 			File file = new File(pathFileDestion);
		 			System.out.println("-------------------File path--------------------");
		 			System.out.println(pathFileDestion);
		 			
		 			ParserXml.appendChildToChannel(file, rightBox, Long.valueOf("50"), Long.valueOf("50") ); 
		 			
		 			
				} catch (PortalException e) {
					e.printStackTrace();
				} catch (SystemException e) {
					e.printStackTrace();
				} catch (NumberFormatException e) {
					e.printStackTrace();
				} catch (XPathExpressionException e) {
					e.printStackTrace();
				} catch (SAXException e) {
					e.printStackTrace();
				} catch (TransformerFactoryConfigurationError e) {
					e.printStackTrace();
				} catch (TransformerException e) {
					e.printStackTrace();
				} catch (ParserConfigurationException e) {
					e.printStackTrace();
				}  
	        }       
	        super.processAction(actionRequest, actionResponse);
	    }
	
}

what's wrong in my code ?? Thanks
thumbnail
Mayur Patel, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Expert Publications: 358 Date d'inscription: 17/11/10 Publications récentes
Hi Jam,

If you are using <aui:form> then you need to modify below code in JSP,

document.<portlet:namespace />fm.<portlet:namespace />hiddenRightFields.value = Liferay.Util.listSelect(document.<portlet:namespace />fm.<portlet:namespace />rightBox); 
document.<portlet:namespace />fm.submit();


This should work emoticon
jam dah, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Junior Member Publications: 43 Date d'inscription: 13/08/14 Publications récentes
unfortunately, this didn't work for me
thumbnail
Mayur Patel, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Expert Publications: 358 Date d'inscription: 17/11/10 Publications récentes
Hi Jam,

Please refer below jsp in which i'm using the same component,

&lt;%@page import="java.util.List"%&gt;
&lt;%@page import="java.util.ArrayList"%&gt;
&lt;%@ include file="init.jsp" %&gt;

<portlet:actionurl var="saveFieldsURL">
	<portlet:param name="tools" value="LISTING" />
	<portlet:param name="action" value="saveFieldsURL" />
	<portlet:param name="isEdit" value="${isEdit}" />
</portlet:actionurl>
<form method="post" action="${saveFieldsURL}" id="columnViewPopupFrm" name="columnViewPopupFrm">
	<input type="hidden" name="listingState" id="<portlet:namespace />listingState" value="${listingState}">
	<header><div class="dialog-header text-center"><h4>Drag to Add or Reorder Columns</h4></div></header>
	<section>
		<div class="dialog-body">
			<div id="dd-contain" class="aui-w100 aui-helper-clearfix">  
			<liferay-ui:input-move-boxes rightList="${displayFields}" rightTitle="Visible Columns" leftBoxName="allFieldsList" leftList="${hiddenFields}" rightBoxName="displayFieldsList" leftTitle="All Columns" leftReorder="false" rightReorder="true" cssClass="custom-move-boxes" />
				<input name="<portlet:namespace />hiddenLeftFields" id="<portlet:namespace />hiddenLeftFields" type="hidden">
				<input name="<portlet:namespace />hiddenRightFields" id="<portlet:namespace />hiddenRightFields" type="hidden">
			</div>
		</div>
	</section>
	<footer>
		<div class="aui-w100 aui-helper-clearfix dialog-footer">
			<div class="aui-column-first aui-column">
				<a href="#" class="cancel" onclick="<portlet:namespace/>columnDialog.close();<portlet:namespace/>columnDialog.destroy();">Cancel</a>
			</div> 
			<div class="aui-column-last aui-column">
				<a href="#" onclick="<portlet:namespace />submitForm();" class="save">Save</a>
			</div>
		</div>
	</footer>
</form>

<aui:script>
Liferay.provide(
window,
'<portlet:namespace />submitForm',
function() {
document.columnViewPopupFrm.<portlet:namespace />hiddenLeftFields.value = Liferay.Util.listSelect(document.columnViewPopupFrm.<portlet:namespace />allFieldsList);
document.columnViewPopupFrm.<portlet:namespace />hiddenRightFields.value = Liferay.Util.listSelect(document.columnViewPopupFrm.<portlet:namespace />displayFieldsList);
document.columnViewPopupFrm.submit();
}, ['liferay-util-list-fields']
);
</aui:script>


Thanks.
jam dah, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Junior Member Publications: 43 Date d'inscription: 13/08/14 Publications récentes
Thanks for your replies and for your time that you spent.
but really i got nothing, please can you look what's wrong in my code.
Can you test it?
view.jsp
&lt;%
/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */
%&gt;

&lt;%@ include file="/init.jsp" %&gt;
&lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt;

<portlet:defineobjects />
<portlet:actionurl var="distURL">
    <portlet:param name="mvcPath" value="/view.jsp" />
</portlet:actionurl>

<aui:form name="<portlet:namespace />fm" action="<%= distURL %>" method="post">
      	
      <aui:select name="selectPlayer" label="Select a Player">
    		<aui:option value="player1"> Player1</aui:option>
            <aui:option value="player2"> Player2</aui:option>
            <aui:option value="player3"> Player3</aui:option>
            <aui:option value="player4"> Player4</aui:option>
            <aui:option value="player5"> Player5</aui:option>
            <aui:option value="player6"> Player6</aui:option>
     </aui:select>	

    	&lt;%  
	      List leftBox = new ArrayList(), rightBox = new ArrayList();  
    	  leftBox.add(new KeyValuePair("channel1", "Channel1"));
	      leftBox.add(new KeyValuePair("channel2", "Channel2"));  
	      leftBox.add(new KeyValuePair("channel3", "Channel3"));  
	      leftBox.add(new KeyValuePair("channel4", "Channel4"));  
	      leftBox.add(new KeyValuePair("channel5", "Channel5"));
	      
	     %&gt;  
      <liferay-ui:input-move-boxes leftBoxName="leftBox" leftTitle="Available channels" leftList="<%=leftBox%>" leftReorder="true" rightBoxName="rightBox" rightTitle="Selected channels" rightList="<%=rightBox%>" rightReorder="true" />   
	 <aui:input type="hidden" name="<portlet:namespace />hiddenRightFields" id="<portlet:namespace />hiddenRightFields" />
     <center><aui:button type="submit" value="Valider" onclick="<portlet:namespace />submitForm();" cssClass=".submitButton" /> </center> 	
</aui:form>

<aui:script>
Liferay.provide(
window,
'<portlet:namespace />submitForm',
function() {
document.fm.<portlet:namespace />hiddenRightFields.value = Liferay.Util.listSelect(document.fm.<portlet:namespace />rightBox);
document.fm.submit();

}, ['liferay-util-list-fields']
);

</aui:script>

java code
package com.amms.portlets; 

import java.io.IOException;
import java.util.List;
import java.io.File;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.xpath.XPathExpressionException;

import org.xml.sax.SAXException;

import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.repository.model.FileEntry;
import com.liferay.portal.kernel.util.KeyValuePair;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.model.PortletPreferences;
import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
import com.netcenter.tools.NetcenterTools;
import com.netcenter.tools.ParserXml;


public class DistrbutionPortlet extends MVCPortlet{

	 @Override
	    public void processAction(
	        ActionRequest actionRequest, ActionResponse actionResponse)
	        throws IOException, PortletException {
		 
	        String selectPlayer = ParamUtil.getString(actionRequest, "selectPlayer");
	        //String[] rightBox = ParamUtil.getParameterValues(actionRequest, "rightBox");
	        String rightBox = ParamUtil.getString(actionRequest, "rightBox");
	        //String toList = ListingUtils.toggleCamelCaseWords(ParamUtil.getString(actionRequest,"hiddenLeftFields"), false);
	        String toList = ParamUtil.getString(actionRequest, "hiddenRightFields"); 
	            
	        System.out.println("-------------------Parameters--------------------"+toList);
	        System.out.println("-------------------------------------------------");
	        System.out.println(selectPlayer);
	        System.out.println(rightBox);
	        
	       
	        
	        ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
	        if((selectPlayer != null)&amp;&amp;(rightBox != null))
	        {
	        	FileEntry fileEntry;
				try {
					fileEntry = DLAppServiceUtil.getFileEntry(themeDisplay.getLayout().getGroupId(), 0, "Distribution");
					String pathFileDestion = NetcenterTools.getDLFileAbsPath(fileEntry);
		 			File file = new File(pathFileDestion);
		 			System.out.println("-------------------File path--------------------");
		 			System.out.println(pathFileDestion);
		 			
		 			ParserXml.appendChildToChannel(file, rightBox, Long.valueOf("50"), Long.valueOf("50") ); 
		 			
		 			
				} catch (PortalException e) {
					e.printStackTrace();
				} catch (SystemException e) {
					e.printStackTrace();
				} catch (NumberFormatException e) {
					e.printStackTrace();
				} catch (XPathExpressionException e) {
					e.printStackTrace();
				} catch (SAXException e) {
					e.printStackTrace();
				} catch (TransformerFactoryConfigurationError e) {
					e.printStackTrace();
				} catch (TransformerException e) {
					e.printStackTrace();
				} catch (ParserConfigurationException e) {
					e.printStackTrace();
				}  
	        }       
	        super.processAction(actionRequest, actionResponse);
	    }
}

thanks a lot
thumbnail
Mayur Patel, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Expert Publications: 358 Date d'inscription: 17/11/10 Publications récentes
Hi Jam,

I've modified my code with whatever you want and I'm able to get values,

Please try below code. It's working fine emoticon

<form name="columnViewPopupFrm" action="<%= saveFieldsURL %>" method="post" id="columnViewPopupFrm">
          
      <aui:select name="selectPlayer" label="Select a Player">
            <aui:option value="player1"> Player1</aui:option>
            <aui:option value="player2"> Player2</aui:option>
            <aui:option value="player3"> Player3</aui:option>
            <aui:option value="player4"> Player4</aui:option>
            <aui:option value="player5"> Player5</aui:option>
            <aui:option value="player6"> Player6</aui:option>
     </aui:select>    

        &lt;%  
          List leftBox = new ArrayList(), rightBox = new ArrayList();  
          leftBox.add(new KeyValuePair("channel1", "Channel1"));
          leftBox.add(new KeyValuePair("channel2", "Channel2"));  
          leftBox.add(new KeyValuePair("channel3", "Channel3"));  
          leftBox.add(new KeyValuePair("channel4", "Channel4"));  
          leftBox.add(new KeyValuePair("channel5", "Channel5"));
          rightBox.add(new KeyValuePair("channel5", "Channel5"));
          
         %&gt;  
      <liferay-ui:input-move-boxes leftBoxName="leftBox" leftTitle="Available channels" leftList="<%=leftBox%>" leftReorder="true" rightBoxName="rightBox" rightTitle="Selected channels" rightList="<%=rightBox%>" rightReorder="true" />   
       
     <input type="hidden" name="<portlet:namespace />hiddenRightFields" id="<portlet:namespace />hiddenRightFields">
     <a href="#" onclick="<portlet:namespace />submitForm();" class="save">Save</a>     
</form>

<aui:script>
Liferay.provide(
window,
'<portlet:namespace />submitForm',
function() {
document.columnViewPopupFrm.<portlet:namespace />hiddenRightFields.value = Liferay.Util.listSelect(document.columnViewPopupFrm.<portlet:namespace />rightBox);
document.columnViewPopupFrm.submit();

}, ['liferay-util-list-fields']
);

</aui:script>


Thanks.
jam dah, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Junior Member Publications: 43 Date d'inscription: 13/08/14 Publications récentes
Really, thanks for your help.
I didn't know what's the matter, but it still not working for me
thumbnail
Mayur Patel, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Expert Publications: 358 Date d'inscription: 17/11/10 Publications récentes
Use simple form instead of AlloyUI form and remove <portlet:namespace /> while submitting form as i've given in last post. Replace code which I've sent & It should work.

In Java class,

String toList = ParamUtil.getString(actionRequest, "hiddenRightFields"); 
jam dah, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Junior Member Publications: 43 Date d'inscription: 13/08/14 Publications récentes
i did, but nothing
view.jsp
&lt;%
/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */
%&gt;

&lt;%@ include file="/init.jsp" %&gt;
&lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt;

<portlet:defineobjects />
<portlet:actionurl var="distURL">
    <portlet:param name="mvcPath" value="/view.jsp" />
</portlet:actionurl>

<aui:select name="selectPlayer" label="Select a Player"> <aui:option value="player1"> Player1</aui:option> <aui:option value="player2"> Player2</aui:option> <aui:option value="player3"> Player3</aui:option> <aui:option value="player4"> Player4</aui:option> <aui:option value="player5"> Player5</aui:option> <aui:option value="player6"> Player6</aui:option> </aui:select> &lt;% List leftBox = new ArrayList(), rightBox = new ArrayList(); leftBox.add(new KeyValuePair("channel1", "Channel1")); leftBox.add(new KeyValuePair("channel2", "Channel2")); leftBox.add(new KeyValuePair("channel3", "Channel3")); leftBox.add(new KeyValuePair("channel4", "Channel4")); leftBox.add(new KeyValuePair("channel5", "Channel5")); rightBox.add(new KeyValuePair("channel5", "Channel5")); %&gt; <liferay-ui:input-move-boxes leftBoxName="leftBox" leftTitle="Available channels" leftList="<%=leftBox%>" leftReorder="true" rightBoxName="rightBox" rightTitle="Selected channels" rightList="<%=rightBox%>" rightReorder="true" cssClass="custom-move-boxes" /> <input type="hidden" name="<portlet:namespace />hiddenRightFields" id="<portlet:namespace />hiddenRightFields"> <center><aui:button type="submit" value="Valider" onclick="<portlet:namespace />submitForm();" /> </center> <aui:script> Liferay.provide( window, '<portlet:namespace />submitForm', function() { document.fm.<portlet:namespace />hiddenRightFields.value = Liferay.Util.listSelect(document.fm.<portlet:namespace />rightBox); document.fm.submit(); }, ['liferay-util-list-fields'] ); </aui:script>
thumbnail
Mayur Patel, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Expert Publications: 358 Date d'inscription: 17/11/10 Publications récentes
Hi Jam,

If you are using liferay version 6.2 then refer below blog,

http://mpatel3.blogspot.in/2014/08/liferay-62-changes-portlet-namespace-in.html

Thanks.
jam dah, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Junior Member Publications: 43 Date d'inscription: 13/08/14 Publications récentes
yes, i am using liferay6.2
thumbnail
Mayur Patel, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ?? (Réponse)

Expert Publications: 358 Date d'inscription: 17/11/10 Publications récentes
Have you tried below code?

String toList = actionRequest.getParameter(actionResponse.getNamespace()+"hiddenRightFields"); 

or
you can set the requires-namespaced-parameters setting to false in your liferay-portlet.xml

<requires-namespaced-parameters>false</requires-namespaced-parameters> 


There should be some version specific issue because i'm using liferay 6.1 GA3 and it's working fine.
jam dah, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Junior Member Publications: 43 Date d'inscription: 13/08/14 Publications récentes
i am using lifreray6.2ga2, i tried to add <requires-namespaced-parameters>false</requires-namespaced-parameters> to liferay-portal.xml. but nothing work.
Thanks
view.jsp
&lt;%
/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */
%&gt;

&lt;%@ include file="/init.jsp" %&gt;
&lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt;

<portlet:defineobjects />

<portlet:actionurl var="distURL">
    <portlet:param name="mvcPath" value="/view.jsp" />
</portlet:actionurl>

<form id="fm" name="fm" action="<%= distURL %>" method="post">
      	
      <aui:select name="selectPlayer" label="Select a Player">
    		<aui:option value="player1"> Player1</aui:option>
            <aui:option value="player2"> Player2</aui:option>
            <aui:option value="player3"> Player3</aui:option>
            <aui:option value="player4"> Player4</aui:option>
            <aui:option value="player5"> Player5</aui:option>
            <aui:option value="player6"> Player6</aui:option>
     </aui:select>	

    	&lt;%  
	      List leftBox = new ArrayList(), rightBox = new ArrayList();  
    	  leftBox.add(new KeyValuePair("channel1", "Channel1"));
	      leftBox.add(new KeyValuePair("channel2", "Channel2"));  
	      leftBox.add(new KeyValuePair("channel3", "Channel3"));  
	      leftBox.add(new KeyValuePair("channel4", "Channel4"));  
	      leftBox.add(new KeyValuePair("channel5", "Channel5"));	      
	     %&gt;  
      <liferay-ui:input-move-boxes leftBoxName="leftBox" leftTitle="Available channels" leftList="<%=leftBox%>" leftReorder="true" rightBoxName="rightBox" rightTitle="Selected channels" rightList="<%=rightBox%>" rightReorder="true" cssClass="custom-move-boxes" />          
	 <aui:input type="hidden" name="hiddenRightFields" id="hiddenRightFields" />
     <center><aui:button type="submit" value="Valider" onclick="<portlet:namespace />submitForm();" /> </center> 	
</form>

<aui:script>
Liferay.provide(
window,
'<portlet:namespace />submitForm',
function() {
document.fm.<portlet:namespace />hiddenRightFields.value = Liferay.Util.listSelect(document.fm.<portlet:namespace />rightBox);
submitForm(document.<portlet:namespace />fm); 

}, ['liferay-util-list-fields']
);

</aui:script>

in the java code
String toList = actionRequest.getParameter(actionResponse.getNamespace()+"hiddenRightFields");
jam dah, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Junior Member Publications: 43 Date d'inscription: 13/08/14 Publications récentes
Thanks a lot for your help, it work now.
thumbnail
Mayur Patel, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Expert Publications: 358 Date d'inscription: 17/11/10 Publications récentes
What was the issue? can you please describe?

Thanks.
jam dah, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Junior Member Publications: 43 Date d'inscription: 13/08/14 Publications récentes
Hi, the issue was
1- with namespace, i am using liferay 6.2
<requires-namespaced-parameters>false</requires-namespaced-parameters> 

2- i forgot to clear project from eclipse
Thanks a lot Mayur.
thumbnail
Mayur Patel, modifié il y a 9 années.

RE: How to use liferay-ui:input-move-boxes ??

Expert Publications: 358 Date d'inscription: 17/11/10 Publications récentes
Nice to hear from you Jamemoticon Happy Learning emoticon