Fórumok
Passing textarea value into actionRequest
Nisarg Parikh, módosítva 11 év-val korábban
Passing textarea value into actionRequest
Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.12.31. Legújabb bejegyzések
Hi All,
I have created on hook for calendar. Created one new tab and page for that tab.
In new jsp I have put below code.
<portlet:actionURL var="editEventURL" windowState="<%= WindowState.MAXIMIZED.toString() %>">
<liferay-portlet:param name="struts_action" value="/calendar/export_events" />
<liferay-portlet:param name="redirect" value="<%= currentURL %>" />
<liferay-portlet:param name="suggestTopic" value="true" />
</portlet:actionURL>
<DIV style="padding-right:10px;">
<br/>Enter your message below:<br/>
<br/>
<textarea style="width: 100%;" name="body" rows="7" wrap="virtual"></textarea>
<br/><br/>
</DIV>
<DIV align="center">
<aui:button onClick="<%= editEventURL %>" value="Send" />
<aui:button onClick="location.href='./ltf'" value="Cancel" />
</DIV>
When it goes to ExportEventsAction.java class, it does not get textarea value. I use below code:
String msgBody = ParamUtil.getString(actionRequest, "body");
I get null only.. Do I need to put <form> tag in jsp?
Please help me with this issue.
Thanks in advance.
-Nisarg
I have created on hook for calendar. Created one new tab and page for that tab.
In new jsp I have put below code.
<portlet:actionURL var="editEventURL" windowState="<%= WindowState.MAXIMIZED.toString() %>">
<liferay-portlet:param name="struts_action" value="/calendar/export_events" />
<liferay-portlet:param name="redirect" value="<%= currentURL %>" />
<liferay-portlet:param name="suggestTopic" value="true" />
</portlet:actionURL>
<DIV style="padding-right:10px;">
<br/>Enter your message below:<br/>
<br/>
<textarea style="width: 100%;" name="body" rows="7" wrap="virtual"></textarea>
<br/><br/>
</DIV>
<DIV align="center">
<aui:button onClick="<%= editEventURL %>" value="Send" />
<aui:button onClick="location.href='./ltf'" value="Cancel" />
</DIV>
When it goes to ExportEventsAction.java class, it does not get textarea value. I use below code:
String msgBody = ParamUtil.getString(actionRequest, "body");
I get null only.. Do I need to put <form> tag in jsp?
Please help me with this issue.
Thanks in advance.
-Nisarg
Krzysztof Gołębiowski, módosítva 11 év-val korábban
RE: Passing textarea value into actionRequest
Liferay Master Bejegyzések: 549 Csatlakozás dátuma: 2011.06.25. Legújabb bejegyzések
I think you definety need to enclose that texatarea and button within a form tag:
<portlet:actionURL var="editEventURL" windowState="<%= WindowState.MAXIMIZED.toString() %>">
<liferay-portlet:param name="struts_action" value="/calendar/export_events" />
<liferay-portlet:param name="redirect" value="<%= currentURL %>" />
<liferay-portlet:param name="suggestTopic" value="true" />
</portlet:actionURL>
<aui:form action="<%= editEventURL %>" method="post" name="fm">
<aui:input name="body" type="textarea" />
<aui:button type="submit" value='send' />
<aui:form>
Regards,
KG
<portlet:actionURL var="editEventURL" windowState="<%= WindowState.MAXIMIZED.toString() %>">
<liferay-portlet:param name="struts_action" value="/calendar/export_events" />
<liferay-portlet:param name="redirect" value="<%= currentURL %>" />
<liferay-portlet:param name="suggestTopic" value="true" />
</portlet:actionURL>
<aui:form action="<%= editEventURL %>" method="post" name="fm">
<aui:input name="body" type="textarea" />
<aui:button type="submit" value='send' />
<aui:form>
Regards,
KG
Subhash Shah, módosítva 11 év-val korábban
RE: Passing textarea value into actionRequest
Junior Member Bejegyzések: 78 Csatlakozás dátuma: 2011.11.30. Legújabb bejegyzések
values of input components within <form>......</form> will be available as request parameters in controller method.
Nisarg Parikh, módosítva 11 év-val korábban
RE: Passing textarea value into actionRequest
Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.12.31. Legújabb bejegyzések
Thanks for your responses.
If I put it in form then there is no action method called. I am not sure why.
If I inspect form element, I can not see the action url. If I put that in button then I see the action url.
I see only this "<form action="" class="aui-form " id="_8_fm" name="_8_fm" method="post">"
Do not know what is happening.
Please help me.
Thank you once again.
-Nisarg
If I put it in form then there is no action method called. I am not sure why.
If I inspect form element, I can not see the action url. If I put that in button then I see the action url.
I see only this "<form action="" class="aui-form " id="_8_fm" name="_8_fm" method="post">"
Do not know what is happening.
Please help me.
Thank you once again.
-Nisarg
Nisarg Parikh, módosítva 11 év-val korábban
RE: Passing textarea value into actionRequest
Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.12.31. Legújabb bejegyzések
I have finally done that by liferay way only.
<aui:form method="post" name="fm">
<portlet:actionURL var="editEventURL" windowState="<%= WindowState.MAXIMIZED.toString() %>">
<liferay-portlet:param name="struts_action" value="/calendar/export_events" />
<liferay-portlet:param name="redirect" value="<%= currentURL %>" />
<liferay-portlet:param name="suggestTopic" value="true" />
</portlet:actionURL>
<%
String taglibOnClick = "document." + renderResponse.getNamespace() + "fm.action = '" + editEventURL + "'; document." + renderResponse.getNamespace() + "fm.submit();";
%>
<DIV style="padding-right:10px;">
<br/>Enter your message below:<br/>
<br/>
<aui:input type="textarea" style="width: 100%;" name="body" rows="7" />
<br/><br/>
</DIV>
<DIV align="center">
<aui:button onClick="<%= taglibOnClick %>" value="Send" style="width:90px;" />
<aui:button onClick="location.href='./ltf'" value="Cancel" style="width:90px;" />
</DIV>
</aui:form>
Thanks for the help.
Thank you.
-Nisarg
<aui:form method="post" name="fm">
<portlet:actionURL var="editEventURL" windowState="<%= WindowState.MAXIMIZED.toString() %>">
<liferay-portlet:param name="struts_action" value="/calendar/export_events" />
<liferay-portlet:param name="redirect" value="<%= currentURL %>" />
<liferay-portlet:param name="suggestTopic" value="true" />
</portlet:actionURL>
<%
String taglibOnClick = "document." + renderResponse.getNamespace() + "fm.action = '" + editEventURL + "'; document." + renderResponse.getNamespace() + "fm.submit();";
%>
<DIV style="padding-right:10px;">
<br/>Enter your message below:<br/>
<br/>
<aui:input type="textarea" style="width: 100%;" name="body" rows="7" />
<br/><br/>
</DIV>
<DIV align="center">
<aui:button onClick="<%= taglibOnClick %>" value="Send" style="width:90px;" />
<aui:button onClick="location.href='./ltf'" value="Cancel" style="width:90px;" />
</DIV>
</aui:form>
Thanks for the help.
Thank you.
-Nisarg