Foren
Save portlet preferences by preferences--parameter--
sawi _, geändert vor 11 Jahren.
Save portlet preferences by preferences--parameter--
Regular Member Beiträge: 165 Beitrittsdatum: 27.03.09 Neueste Beiträge
Hi
It's working in 6.x Liferay?
<aui:input name="preferences--parameter--" value="" type="text"/>
Because not working for me if I extended asset publishser.
Regards
sawi
It's working in 6.x Liferay?
<aui:input name="preferences--parameter--" value="" type="text"/>
Because not working for me if I extended asset publishser.
Regards
sawi
Amit Doshi, geändert vor 11 Jahren.
RE: Save portlet preferences by preferences--parameter--
Liferay Master Beiträge: 550 Beitrittsdatum: 29.12.10 Neueste Beiträgesawi _:
Hi
It's working in 6.x Liferay?
<aui:input name="preferences--parameter--" value="" type="text"/>
Because not working for me if I extended asset publishser.
Regards
sawi
What you are exactly looking for?
If you are looking to store value in portlet prefrence then below is the code.
final PortletPreferences prefs = portletRequest.getPreferences();
prefs.setValue("paramName", "paramValue");
prefs.store();
Thanks & Regards,
Amit Doshi
Hitoshi Ozawa, geändert vor 11 Jahren.
RE: Save portlet preferences by preferences--parameter--
Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Alloy UI is just an user interface library so it won't save any data.
Follow Amit's instructions and create a Java class which is invoked from your FORM if you want to save your data.
Follow Amit's instructions and create a Java class which is invoked from your FORM if you want to save your data.
Jitendra Rajput, geändert vor 11 Jahren.
RE: Save portlet preferences by preferences--parameter--
Liferay Master Beiträge: 875 Beitrittsdatum: 07.01.11 Neueste Beiträge
Its is working with Liferay 6.1
Define your AUI element with below syntax
It should follow pattern like preferences--paramName-- .
And make sure you use below Configuration class in your liferay-portlet.xml
By using this way we dont need to write any code to store form element value into preferences . DefaultConfigurationAction class will detect form element with specified syntax and store the same in preference for you.
In case if you want to retrieve value from preference then directly use
Define your AUI element with below syntax
<aui:input name="preferences--showFeedTitle--" type="checkbox" value="<%= showFeedTitle %>" />
It should follow pattern like preferences--paramName-- .
And make sure you use below Configuration class in your liferay-portlet.xml
<configuration-action-class>com.liferay.portal.kernel.portlet.DefaultConfigurationAction</configuration-action-class>
By using this way we dont need to write any code to store form element value into preferences . DefaultConfigurationAction class will detect form element with specified syntax and store the same in preference for you.
In case if you want to retrieve value from preference then directly use
preferences.getValue("showFeedTitle")
// No need to use that syntax to get value
Hitoshi Ozawa, geändert vor 11 Jahren.
RE: Save portlet preferences by preferences--parameter--
Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Interesting. Have to test it out.
The normal way to save configuration is outlined in the page below.
http://www.liferaysolution.com/2012/05/add-configuration-page-in-plugin.html
The normal way to save configuration is outlined in the page below.
http://www.liferaysolution.com/2012/05/add-configuration-page-in-plugin.html
Jitendra Rajput, geändert vor 11 Jahren.
RE: Save portlet preferences by preferences--parameter--
Liferay Master Beiträge: 875 Beitrittsdatum: 07.01.11 Neueste Beiträge
Yes its interesting and it will reduce code to store form elements values in preferences.
Listed same thing on my blog as well.
http://itsliferay.blogspot.in/2012/07/advantage-of-using-liferay-61.html
Listed same thing on my blog as well.
http://itsliferay.blogspot.in/2012/07/advantage-of-using-liferay-61.html
Amit Doshi, geändert vor 11 Jahren.
RE: Save portlet preferences by preferences--parameter--
Liferay Master Beiträge: 550 Beitrittsdatum: 29.12.10 Neueste BeiträgeJitendra Rajput:
Yes its interesting and it will reduce code to store form elements values in preferences.
I would definitely like to give a try for it. It's something new today I learned from you.
Thanks for sharing this information.
Gaurav kalia, geändert vor 10 Jahren.
RE: Save portlet preferences by preferences--parameter--
New Member Beiträge: 14 Beitrittsdatum: 13.08.12 Neueste Beiträge
Hi Jitendra
Any idea how can I use the same mechanism for dropdown if I am selecting multiple values ?
Thanks
Gaurav
Any idea how can I use the same mechanism for dropdown if I am selecting multiple values ?
Thanks
Gaurav
Riccardo Rotondo, geändert vor 8 Jahren.
RE: Save portlet preferences by preferences--parameter--
Junior Member Beiträge: 29 Beitrittsdatum: 11.06.10 Neueste Beiträge
Hi, what if the preferences I'm dealing with have multiple values? Any fast way to update the value with preferences--parameters-- ??
I'll explain better with an example. Suppose I have in my portlet.xml
And in my config.jsp
After the submit the preference "MultipleValues" will be updated only with one value and it changes from a String[2] to a simple String.
Any way to specify a in the aui to refers to the index like preferences-MultipleValues-[0] ??
Thank you in advance for the help.
Cheers
I'll explain better with an example. Suppose I have in my portlet.xml
<preference>
<name>MultipleValues</name>
<value>Number 2</value>
<value>Number 3</value>
</preference>
And in my config.jsp
<%
PortletPreferences preferences = renderRequest.getPreferences();
String portletResource = ParamUtil.getString(request, "portletResource");
PortletPreferences prefs =
PortletPreferencesFactoryUtil.getPortletSetup(request, portletResource);
String [] mul = prefs.getValues("MultipleValues",
new String []{"", ""});
%>
<aui:form action="<%= configurationURL %>" method="post" name="fm">
<aui:input name="<%= Constants.CMD %>" type="hidden" value="<%= Constants.UPDATE %>" />
<aui:input name="preferences--MultipleValues--" type="text" value="<%= mul[0] %>" />
<aui:input name="preferences--MultipleValues--" type="text" value="<%= mul[1] %>" />
<aui:button-row>
<aui:button type="submit" />
</aui:button-row>
</aui:form>
After the submit the preference "MultipleValues" will be updated only with one value and it changes from a String[2] to a simple String.
Any way to specify a in the aui to refers to the index like preferences-MultipleValues-[0] ??
Thank you in advance for the help.
Cheers
Chandan Sharma, geändert vor 8 Jahren.
RE: Save portlet preferences by preferences--parameter--
Junior Member Beiträge: 63 Beitrittsdatum: 28.05.12 Neueste Beiträgesawi _:
Hi
It's working in 6.x Liferay?
<aui:input name="preferences--parameter--" value="" type="text"/>
Because not working for me if I extended asset publishser.
Regards
sawi
I tried with Liferay 6.2 it is not working for me. but it is working in Liferay 6.1.
Thanks
Chandan