Foren

Alloy UI Form submission

thumbnail
Nilesh Nemichand Gundecha, geändert vor 13 Jahren.

Alloy UI Form submission

Regular Member Beiträge: 205 Beitrittsdatum: 01.12.09 Neueste Beiträge
Hi Folks,

I am newbie and developing portlets using Alloy UI taglib. I am facing couple of problems -

1) When I am trying to submit aui:form from using javascript function, the submission is not taking place -

//javascript function

function submitForm(){
//some code
document.<form_name>.submit();
}
</form_name>


When I am writing such a javascript, the form is not getting submitted. Whereas, if I make my <aui:form> tag to simply <form>, the same code works absolutely fine.


2) Similar problem I am facing for <aui:input type="hidden" name="action" id="actionId">

In this case also, when I try to assign value to this hidden variable using javascript function, this does not work.


function submitForm(){
//some code

document.getElementById('actionId').value="search";

document.<form_name>.submit();
}

</form_name>


But if I use same without alloy UI, like <input type="hidden" .......>, This works fine.

Any help will be highly appreciated. Please help.


Thanks and Regards,
Nilesh.
thumbnail
AKASH PATIL, geändert vor 13 Jahren.

RE: Alloy UI Form submission

Junior Member Beiträge: 75 Beitrittsdatum: 13.12.10 Neueste Beiträge
Hi,

I am also facing similar problem. Please point me to the right direction. Thanking you in anticipation. Please help ASAP.

Regards,
Akash.
thumbnail
José Manuel Domínguez Romero, geändert vor 13 Jahren.

RE: Alloy UI Form submission (Antwort)

Regular Member Beiträge: 219 Beitrittsdatum: 03.02.10 Neueste Beiträge
Hi Nilesh,

You must insert the Liferay tag

<portlet:namespace />


When you use something similar to this:

<aui:input name="name_of_input" type="text" id="id_of_input" />


The final generated code is similar to this:

<input class="aui-field-input aui-field-input-text" id="_xxxx_id_of_input" name="_xxxx_name_of_input" type="text" value="">


Where xxxx is the portlet namespace. Then, if you want use getElementById:

myAUInput = document.getElementById("<portlet:namespace />id_of_input");


And if you have a form similar to this:

<aui:form action="<%= configurationURL %>" method="post" name="myFrm"></aui:form>


You "catch" it with:

document.<portlet:namespace />myFrm


And finaly:


myAUInput.value = "something";

or...

document.<portlet:namespace />myFrm.<portlet:namespace />id_of_input.value = "something";

or...

document.<portlet:namespace />myFrm.submit();



Regards
thumbnail
Nilesh Nemichand Gundecha, geändert vor 13 Jahren.

RE: Alloy UI Form submission

Regular Member Beiträge: 205 Beitrittsdatum: 01.12.09 Neueste Beiträge
Thanks a lot Jose for your reply with wonderful explanation.. It works fine.. And also understood the reason for adding the <portlet:namespace />

Thanks again.

Regards,
Nilesh.
thumbnail
AKASH PATIL, geändert vor 13 Jahren.

RE: Alloy UI Form submission

Junior Member Beiträge: 75 Beitrittsdatum: 13.12.10 Neueste Beiträge
Thank a lot, it works fine. ,
anand gopalan, geändert vor 10 Jahren.

RE: Alloy UI Form submission

Expert Beiträge: 442 Beitrittsdatum: 02.03.12 Neueste Beiträge
Hi Jose,

I am Using .<portlet:namespace /> in javascript - throwing error.

view.jsp - using Alloy and plain javascript.

Liferay6.1.0 CE, Liferay plugin SDK and Eclipse Helios


Can you please help me and I post my request in below URL.

http://www.liferay.com/community/forums/-/message_boards/message/25913208