Fórum

How to submit Form

ildar sl, modificado 7 Anos atrás.

How to submit Form

Regular Member Postagens: 158 Data de Entrada: 12/12/11 Postagens Recentes
Hi!!
Have:
view.jsp
Liferay.Util.openWindow(
	{
		dialog: {
			modal: true,
			toolbars: {
				footer: [
					{
						label: Liferay.Language.get('ok'),
						on: {
							click: function(event) {
								Object.keys(event).map(function(objectKey, index) {
									var value = event[objectKey];
									console.log("====="+value);
								});
								event.preventDefault();
								event.domEvent.preventDefault();
							}
						},
						primary: true
					},

				]
			},
		},
		id: '<portlet:namespace />dialog',
		uri: url.toString()
	}
);


modal.jsp
<aui:form action="<%= addDDDURL %>" method="post" name="fm" onsubmit="<%= &quot;event.preventDefault(); &quot; + renderResponse.getNamespace() + &quot;addDDD();&quot; %>">
	<aui:input name="bidName" />
</aui:form>
<aui:script>
	function <portlet:namespace />addDDD() {
		submitForm(document.<portlet:namespace />fm);
	}
</aui:script>


Already tried a lot of options. Do not sent the form. Since sendbutton created a javascript. Help me please.
thumbnail
Andrew Jardine, modificado 7 Anos atrás.

RE: How to submit Form

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hi Ildar,

Couple of things. First, I'm not seeing a submit button on your form -- assuming that you are providing just part of the JSP, how are you triggering the submit action? My next question is that I can see you have this -

<aui:form action="<%= addDDDURL %>" ...< code></aui:form>
<br><br>but you are not showing how you created that URL. Typically, since you have addDDDURL, which assume you created with either a &lt;portlet:actionURL/&gt; or a &lt;liferay-portlet:actionURL/&gt;, in which case all you should need to submit the form is a &lt;aui:input type="submit"/&gt; on your form.
ildar sl, modificado 7 Anos atrás.

RE: How to submit Form

Regular Member Postagens: 158 Data de Entrada: 12/12/11 Postagens Recentes
Hi Andrew!

Yes, of course I did not forget the generation URL
<portlet:actionurl name="addDDD" var="addDDDURL" />


Yes you are right. Here, the problem is that submit button is not within a form. Even without inside modal iframe.

If the button is placed in modal.jsp all perfectly functioning. But this option is not currently fit to me
ildar sl, modificado 7 Anos atrás.

RE: How to submit Form (Resposta)

Regular Member Postagens: 158 Data de Entrada: 12/12/11 Postagens Recentes
Solved emoticon
Thanks to site https://www.sitepoint.com/community/t/how-to-submit-a-form-in-an-iframe-with-post-data/6089/2