Fórum

Unable to submit the form using button with java script code

Kiran Kumar Boyini, modificado 11 Anos atrás.

Unable to submit the form using button with java script code

Expert Postagens: 287 Data de Entrada: 02/06/11 Postagens Recentes
Hi All,

I want to submit the form using the button with javascript function as follows

button code :

<input type="button" value="save" onclick="submitForm()"/>

Java script function :

function submitForm(){
if(validateForm()){
document.ReleaseInformation.action = "<%=actionURL.toString()%>";
document.ReleaseInformation.submit();
}
}


But I am not able to submit the form . I am using action class which is extending the MVCPortlet.

Please tell me where I did mistake.
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: Unable to submit the form using button with java script code

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
My first guess is that you don't understand how the namespacing works.

My second guess is that validateForm() returned false, thus preventing the submit.
Kiran Kumar Boyini, modificado 11 Anos atrás.

RE: Unable to submit the form using button with java script code

Expert Postagens: 287 Data de Entrada: 02/06/11 Postagens Recentes
HI ,


No validateForm() returning true value,I have checked just now.

But it is going to the render method of action class.But it has to go process action method.

The following statement is printing which is inside the render method.

######This is inside the render()of ReleaseTaskMVC portlet #######

can any body tell me the reason.

Regards,

Kiran
thumbnail
Anil Sunkari, modificado 11 Anos atrás.

RE: Unable to submit the form using button with java script code

Expert Postagens: 427 Data de Entrada: 12/08/09 Postagens Recentes
Can you try in this manner???

function submitForm(){
document.getElementById('ReleaseInformation').action="<portlet:actionURL><portlet:param name='action' value='XXXX' /></portlet:actionURL>";
document.forms['ReleaseInformation'].submit();
}


Make sure with your form name & update action value parameter.

Regards,
Anil Sunkari
Kiran Kumar Boyini, modificado 11 Anos atrás.

RE: Unable to submit the form using button with java script code

Expert Postagens: 287 Data de Entrada: 02/06/11 Postagens Recentes
Thanks for your response,

I tried but it is going to the render method of action class.But it has to go process action method.

The following statement is printing which is inside the render method.

######This is inside the render()of ReleaseTaskMVC portlet #######

Regards,

Kiran
thumbnail
Priyanka Dhingra, modificado 11 Anos atrás.

RE: Unable to submit the form using button with java script code

Liferay Master Postagens: 501 Data de Entrada: 20/12/11 Postagens Recentes
It will be better if you could put the whole code here