Foros de discusión
Alloy UI form
Priyanka Dhingra, modificado hace 11 años.
Alloy UI form
Liferay Master Mensajes: 501 Fecha de incorporación: 20/12/11 Mensajes recientes
Hi,
I used aui:form
but
document.<portlet:namespace />fm.submit(); statement is not working
Help me, resolve this
thanks in advance
regards
Priyanka
I used aui:form
<aui:form action="<%=actionMethod%>" name="<portlet:namespace />fm" method="post">
<aui:button-row>
<aui:button type="submit" value="save" onClick="submitForm();" />
<aui:button value="cancel" />
</aui:button-row>
</aui:form>
<script type="text/javascript">
function submitForm() {
alert("In submit form");
document.<portlet:namespace />fm.submit();
}
</script>
but
document.<portlet:namespace />fm.submit(); statement is not working
Help me, resolve this
thanks in advance
regards
Priyanka
Rakesh Goswami, modificado hace 11 años.
RE: Alloy UI form
New Member Mensajes: 15 Fecha de incorporación: 21/02/12 Mensajes recientes
Hi..Priyanka
in place of name='<portlet:namespace />fm' use name="fm" only. just one change required. Keep all other things as it is. it will work.
in place of name='<portlet:namespace />fm' use name="fm" only. just one change required. Keep all other things as it is. it will work.
Priyanka Dhingra, modificado hace 11 años.
RE: Alloy UI form
Liferay Master Mensajes: 501 Fecha de incorporación: 20/12/11 Mensajes recientes
Hi Rakesh,
thanks for the reply
but its not working
thanks for the reply
but its not working
sangeeth k, modificado hace 11 años.
RE: Alloy UI form
Regular Member Mensajes: 114 Fecha de incorporación: 22/04/12 Mensajes recientes
Priyanka Dhingra, modificado hace 11 años.
RE: Alloy UI form
Liferay Master Mensajes: 501 Fecha de incorporación: 20/12/11 Mensajes recientes
Hi Sangeeth,
I checked the link
but the form is html form
I want the solution for <aui:form> if you can help
Thanks anyways for replying
Regards
Priyanka
I checked the link
but the form is html form
I want the solution for <aui:form> if you can help
Thanks anyways for replying
Regards
Priyanka
manasa chandri, modificado hace 11 años.
RE: Alloy UI form
Regular Member Mensajes: 152 Fecha de incorporación: 28/09/10 Mensajes recientes
Hi Priyanka,
Try this below code
<aui:form action='<%=actionMethod%>' id='<portlet:namespace />fm' name='<portlet:namespace />fm'
method="post">
When ever your calling the script, you need to give form id.
Thanks & Regards,
Manasa.chandri.
Try this below code
<aui:form action='<%=actionMethod%>' id='<portlet:namespace />fm' name='<portlet:namespace />fm'
method="post">
When ever your calling the script, you need to give form id.
Thanks & Regards,
Manasa.chandri.
Priyanka Dhingra, modificado hace 11 años.
RE: Alloy UI form
Liferay Master Mensajes: 501 Fecha de incorporación: 20/12/11 Mensajes recientes
Hi Manasa,
Nope, not working.
You try to run this code:
Nope, not working.
You try to run this code:
<aui:form action="<%=actionMethod%>" name="<portlet:namespace />fm" id="<portlet:namespace />fm" method="post" onsubmit="xxx();">
<aui:button-row>
<aui:button value="save" onClick="<portlet:namespace />submitForm();" />
<aui:button value="cancel" />
</aui:button-row>
</aui:form>
<script type="text/javascript">
function submitForm() {
alert("In submit form");
document.<portlet:namespace />fm.submit();
}
function xxx() {
alert("going from xxx");
}
</script>
manasa chandri, modificado hace 11 años.
RE: Alloy UI form
Regular Member Mensajes: 152 Fecha de incorporación: 28/09/10 Mensajes recientes
Hi Priyanka,
Where is the url, your didn't written type ="submit", other wise write the url in javascript.
(like: submitForm(url){
// your code
var URL = '<%=url%>';
document.fm.method="post";
document.fm.action = URL;
document.fm.submit();
}
)
Thanks & Regards,
Manasa.chandri.
Where is the url, your didn't written type ="submit", other wise write the url in javascript.
(like: submitForm(url){
// your code
var URL = '<%=url%>';
document.fm.method="post";
document.fm.action = URL;
document.fm.submit();
}
)
Thanks & Regards,
Manasa.chandri.
Vishal Panchal, modificado hace 11 años.
RE: Alloy UI form
Expert Mensajes: 289 Fecha de incorporación: 20/05/12 Mensajes recientes
Hi Priyanka,
According to me your code is fine but it can be possible that the javascript function submitForm() could not be find.
So , You may do one thing that you can write your following lines of code(<script></script>) at the beginning of jsp page ..
<script type="text/javascript">
function submitForm() {
alert("In submit form");
document.<portlet:namespace />fm.submit();
}
</script>
Hope it will work for you,
Thanks & Regards,
Vishal R. Panchal
According to me your code is fine but it can be possible that the javascript function submitForm() could not be find.
So , You may do one thing that you can write your following lines of code(<script></script>) at the beginning of jsp page ..
<script type="text/javascript">
function submitForm() {
alert("In submit form");
document.<portlet:namespace />fm.submit();
}
</script>
Hope it will work for you,
Thanks & Regards,
Vishal R. Panchal
Priyanka Dhingra, modificado hace 11 años.
RE: Alloy UI form
Liferay Master Mensajes: 501 Fecha de incorporación: 20/12/11 Mensajes recientes
Hi Vishal,
Nope, its not working
Nope, its not working
Amit Doshi, modificado hace 11 años.
RE: Alloy UI form
Liferay Master Mensajes: 550 Fecha de incorporación: 29/12/10 Mensajes recientes
Priyanka :-
My First point is if you written
It will directly submit the form. Then what will be the difference between type="button" and type="submit"
Submit itself tells it will submit the form. Then what's the need of JavaScript function for it.
If you had written type="button" then you need to write javascript in order to submit the form.
And I don't think it matters what you write the name in the form. submit button will submit the form whatever the name will be.
I think you are missing something in making the action='<%=actionMethod%>'
Hope I am clear.
Regards,
Amit Doshi
<aui:form action='<%=actionMethod%>' name='<portlet:namespace />fm'
method="post">
<aui:button-row>
<aui:button type="submit" value="save" onClick="submitForm();" />
<aui:button value="cancel" />
</aui:button-row>
</aui:form >
<script type="text/javascript">
function submitForm() {
alert("In submit form");
document.<portlet:namespace />fm.submit();
}
</script>
My First point is if you written
<aui:button type="submit" value="save" onClick="submitForm();" />
It will directly submit the form. Then what will be the difference between type="button" and type="submit"
Submit itself tells it will submit the form. Then what's the need of JavaScript function for it.
If you had written type="button" then you need to write javascript in order to submit the form.
And I don't think it matters what you write the name in the form. submit button will submit the form whatever the name will be.
I think you are missing something in making the action='<%=actionMethod%>'
Hope I am clear.
Regards,
Amit Doshi
Priyanka Dhingra, modificado hace 11 años.
RE: Alloy UI form
Liferay Master Mensajes: 501 Fecha de incorporación: 20/12/11 Mensajes recientes
Hi Amit,
this is the code...
The actionURL is working without this document.<portlet:namespace />fm.submit(); containing function....i verified
but this statement is not getting executed
this is the code...
<portlet:actionurl var="actionMethod" name="actionMethod" />
<script type="text/javascript">
function submitForm() {
alert("In submit form");
document.<portlet:namespace />fm.submit();
}
function xxx() {
alert("going from xxx");
}
</script>
<aui:form action="<%=actionMethod%>" name="<portlet:namespace />fm" id="<portlet:namespace />fm" method="post" onsubmit="xxx();">
<aui:button-row>
<aui:button value="save" onClick="<portlet:namespace />submitForm();" />
<aui:button value="cancel" />
</aui:button-row>
</aui:form>
The actionURL is working without this document.<portlet:namespace />fm.submit(); containing function....i verified
but this statement is not getting executed
Amit Doshi, modificado hace 11 años.
RE: Alloy UI form
Liferay Master Mensajes: 550 Fecha de incorporación: 29/12/10 Mensajes recientes
It will never run.
Here I am highlighting some of the point.
Because the name='<portlet:namespace />fm' which you have used in form will make internally something name of the form like _portletname_fm. Check the name of that form with the help of firebug.
And when you write javascript like
It will check for the form name like "<portlet:namespace />fm". As It is written in javascript. It will not automatically create portletnamespace for the portlet.
you have to pass that parameter from the javascript function.
And it will never get any form with the name like "<portlet:namespace />fm".
So you need to do something like this
Hope I am clear.
Thanks & Regards,
Amit Doshi
Here I am highlighting some of the point.
Because the name='<portlet:namespace />fm' which you have used in form will make internally something name of the form like _portletname_fm. Check the name of that form with the help of firebug.
And when you write javascript like
document.<portlet:namespace />fm.submit();
It will check for the form name like "<portlet:namespace />fm". As It is written in javascript. It will not automatically create portletnamespace for the portlet.
you have to pass that parameter from the javascript function.
And it will never get any form with the name like "<portlet:namespace />fm".
So you need to do something like this
<portlet:actionurl var="actionMethod" name="actionMethod" />
<script type="text/javascript">
function submitForm(portletnamespace) {
var frmname=portletnamespace+"fm";
alert("In submit form");
xxx();
document.frmname.submit();
}
function xxx() {
alert("going from xxx");
}
</script>
<aui:form action="<%=actionMethod%>" name="<portlet:namespace />fm" id="<portlet:namespace />fm" method="post">
<aui:button-row>
<aui:button value="save" onClick="submitForm('<portlet:namespace />');" />
<aui:button value="cancel" />
</aui:button-row>
</aui:form>
Hope I am clear.
Thanks & Regards,
Amit Doshi
Manoj Prasad, modificado hace 9 años.
RE: Alloy UI form
New Member Mensajes: 14 Fecha de incorporación: 20/03/13 Mensajes recientes
Seems to work as per Amit's suggestion
However my problem is slightly different, in this code below, when the save button is clicked, the FormTestPortlet.addProduct method does not get executed.
<portlet:actionURL var="addProduct" name="addProduct" />
<script type="text/javascript">
function submitForm(portletnamespace) {
var frmname=portletnamespace+"fm";
alert("In submit form");
xxx();
}
function xxx() {
alert("going from xxx");
}
</script>
<aui:form action='<%=addProduct%>' name='<portlet:namespace />fm'
id='<portlet:namespace />fm' method="post" >
<aui:button-row>
<aui:button value="save" />
<aui:button value="cancel" onClick="submitForm('<portlet:namespace />');" />
</aui:button-row>
</aui:form>
Portlet class has :
public class FormTestPortlet extends MVCPortlet {
public void addProduct(ActionRequest request, ActionResponse response)
throws Exception {
System.out.println("Gauranga!!!");
}
}
portlet.xml has
<portlet-name>form-test</portlet-name>
<display-name>Form Test</display-name>
<portlet-class>com.test.FormTestPortlet</portlet-class>
<init-param>
<name>view-template</name>
<value>/html/formtest/view.jsp</value>
</init-param>
However my problem is slightly different, in this code below, when the save button is clicked, the FormTestPortlet.addProduct method does not get executed.
<portlet:actionURL var="addProduct" name="addProduct" />
<script type="text/javascript">
function submitForm(portletnamespace) {
var frmname=portletnamespace+"fm";
alert("In submit form");
xxx();
}
function xxx() {
alert("going from xxx");
}
</script>
<aui:form action='<%=addProduct%>' name='<portlet:namespace />fm'
id='<portlet:namespace />fm' method="post" >
<aui:button-row>
<aui:button value="save" />
<aui:button value="cancel" onClick="submitForm('<portlet:namespace />');" />
</aui:button-row>
</aui:form>
Portlet class has :
public class FormTestPortlet extends MVCPortlet {
public void addProduct(ActionRequest request, ActionResponse response)
throws Exception {
System.out.println("Gauranga!!!");
}
}
portlet.xml has
<portlet-name>form-test</portlet-name>
<display-name>Form Test</display-name>
<portlet-class>com.test.FormTestPortlet</portlet-class>
<init-param>
<name>view-template</name>
<value>/html/formtest/view.jsp</value>
</init-param>