<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>submitting a single form among multiple forms</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=4269502" />
  <subtitle>submitting a single form among multiple forms</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=4269502</id>
  <updated>2026-04-06T06:54:41Z</updated>
  <dc:date>2026-04-06T06:54:41Z</dc:date>
  <entry>
    <title>RE: submitting a single form among multiple forms</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4273708" />
    <author>
      <name>G P</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4273708</id>
    <updated>2009-11-13T08:50:42Z</updated>
    <published>2009-11-13T08:50:42Z</published>
    <summary type="html">hi Ray Augé / Samuel Kong,&lt;br /&gt;Thanks for your support. This working great.&lt;br /&gt;&lt;br /&gt;Special thanks to Ray, for providing such a useful code snippet.&lt;br /&gt;&lt;br /&gt;now, everything working great.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;giri</summary>
    <dc:creator>G P</dc:creator>
    <dc:date>2009-11-13T08:50:42Z</dc:date>
  </entry>
  <entry>
    <title>RE: submitting a single form among multiple forms</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4272674" />
    <author>
      <name>Ray Augé</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4272674</id>
    <updated>2009-11-13T05:20:24Z</updated>
    <published>2009-11-13T05:20:24Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Rather than having many forms we tupically have a hidden form field:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;input name="&amp;lt;portlet:namespace/&amp;gt;cmd" type="hidden" value="&amp;lt;%= (entity != null ? &amp;amp;quot;update&amp;amp;quot; : &amp;amp;quot;add&amp;amp;quot;) %&amp;gt;"&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;then in the html if we have several different operations, these are typically invoked by different buttons calling some javascript method which changes the value of "cmd":&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;
&amp;lt;input type="submit" value="&amp;lt;liferay-ui:message key=" save"&amp;gt;" /&amp;amp;gt;
&amp;lt;input type="button" value="&amp;lt;liferay-ui:message key=" expire"&amp;gt;" onClick="&amp;lt;portlet:namespace /&amp;gt;expire();" /&amp;amp;gt;
&amp;lt;input type="button" value="&amp;lt;liferay-ui:message key=" download"&amp;gt;" onClick="&amp;lt;portlet:namespace /&amp;gt;downloadContent();" /&amp;amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;the javascript functions look something like this:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;	function &amp;lt;portlet:namespace /&amp;gt;expire() {
		document.&amp;lt;portlet:namespace /&amp;gt;fm1.&amp;lt;portlet:namespace /&amp;gt;cmd.value = "expire";
		submitForm(document.&amp;lt;portlet:namespace /&amp;gt;fm1);
	}
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;Now later in the processAction method:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;		String cmd = ParamUtil.getString(actionRequest, "cmd");

			if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) {
				article = updateArticle(actionRequest);
			}

			...&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;Simple enough?&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Ray Augé</dc:creator>
    <dc:date>2009-11-13T05:20:24Z</dc:date>
  </entry>
  <entry>
    <title>RE: submitting a single form among multiple forms</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4272669" />
    <author>
      <name>Samuel Kong</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4272669</id>
    <updated>2009-11-13T05:18:40Z</updated>
    <published>2009-11-13T05:18:40Z</published>
    <summary type="html">You could probably use a hidden input.</summary>
    <dc:creator>Samuel Kong</dc:creator>
    <dc:date>2009-11-13T05:18:40Z</dc:date>
  </entry>
  <entry>
    <title>RE: submitting a single form among multiple forms</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4272301" />
    <author>
      <name>G P</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4272301</id>
    <updated>2009-11-13T03:32:09Z</updated>
    <published>2009-11-13T03:32:09Z</published>
    <summary type="html">hi team,&lt;br /&gt;Please respond. It is a bit urgent.</summary>
    <dc:creator>G P</dc:creator>
    <dc:date>2009-11-13T03:32:09Z</dc:date>
  </entry>
  <entry>
    <title>submitting a single form among multiple forms</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4269501" />
    <author>
      <name>G P</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4269501</id>
    <updated>2009-11-12T12:39:53Z</updated>
    <published>2009-11-12T12:39:53Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi team,&lt;br&gt;I' Mdeveloping simple jsp-jdbc portlet.&lt;br&gt;In the View.jsp I'm having various forms. like,&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;form method="POST" action="&amp;lt;portlet:actionURL/&amp;gt;" name="form1"&amp;gt; &amp;lt;/form&amp;gt;
&amp;lt;form method="POST" action="&amp;lt;portlet:actionURL/&amp;gt;" name="form2"&amp;gt; &amp;lt;/form&amp;gt;
&amp;lt;form method="POST" action="&amp;lt;portlet:actionURL/&amp;gt;" name="form3"&amp;gt; &amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;But whenever I click on submit button of any of the above form, the processAction() method will be invoking.&lt;br&gt;But how to invoke a particular form.&lt;br&gt;&lt;br&gt;My idea was, getting the form name in processAction() method and, based on that we need to perform the actions (using if,else).&lt;br&gt;&lt;br&gt;Is it a right way? If yes, Can anyone suggest me how to get the form name in procesAction() method of my Portlet ?&lt;br&gt;&lt;br&gt;If the above process is completely wrong, Please suggest me the right wat to achieve this.&lt;br&gt;&lt;br&gt;Thanks in advance.&lt;br&gt;&lt;br&gt;Regards,&lt;br&gt;Giri&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>G P</dc:creator>
    <dc:date>2009-11-12T12:39:53Z</dc:date>
  </entry>
</feed>
