Fórum

Alloy UI Form submission

thumbnail
Nilesh Nemichand Gundecha, modificado 13 Anos atrás.

Alloy UI Form submission

Regular Member Postagens: 205 Data de Entrada: 01/12/09 Postagens Recentes
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, modificado 13 Anos atrás.

RE: Alloy UI Form submission

Junior Member Postagens: 75 Data de Entrada: 13/12/10 Postagens Recentes
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, modificado 13 Anos atrás.

RE: Alloy UI Form submission (Resposta)

Regular Member Postagens: 219 Data de Entrada: 03/02/10 Postagens Recentes
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, modificado 13 Anos atrás.

RE: Alloy UI Form submission

Regular Member Postagens: 205 Data de Entrada: 01/12/09 Postagens Recentes
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, modificado 13 Anos atrás.

RE: Alloy UI Form submission

Junior Member Postagens: 75 Data de Entrada: 13/12/10 Postagens Recentes
Thank a lot, it works fine. ,
anand gopalan, modificado 10 Anos atrás.

RE: Alloy UI Form submission

Expert Postagens: 442 Data de Entrada: 02/03/12 Postagens Recentes
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