Forums de discussion
submit form by using javascript and using alloy ui tag
asif aftab, modifié il y a 10 années.
submit form by using javascript and using alloy ui tag
Regular Member Publications: 123 Date d'inscription: 02/09/13 Publications récentes
I have to navigate from one jsp to another by using button. for that reason I just created an action class in which I can jump dynamically
So I just used javascript function and then to jsp.
my js function is
and my code is
but in javascript I got an error that either value is null or not an object in
document.getElementById
I already did lots of time the same thing but without using aui.So please help me
thanks
asif aftab
<portlet:actionurl var="viewCall" name="returnView"></portlet:actionurl>
So I just used javascript function and then to jsp.
my js function is
<aui:script>
function viewFun() //redirect to insert action class
{
document.getElementById("<portlet:namespace />viewDisplayd").action='<%=viewCall.toString()%>';
// alert("hello");
document.getElementById('<portlet:namespace />viewDisplayd').submit();
}
</aui:script>
and my code is
<aui:form id="viewDisplayd" method="post">
<aui:input type="button" value="back" name="hello" onclick="viewFun();"></aui:input>
</aui:form>
but in javascript I got an error that either value is null or not an object in
document.getElementById
I already did lots of time the same thing but without using aui.So please help me
thanks
asif aftab
Atin Agarwal, modifié il y a 10 années.
RE: submit form by using javascript and using alloy ui tag
Junior Member Publications: 86 Date d'inscription: 20/02/12 Publications récentes
Hi Asif,
If you simply want to navigate from one jsp to another then there is no need to use action URL , you can simply use render URL for that.
Suppose you want to navigate from a.jsp to b.jsp then simply use the following code on your a.jsp -
<portlet:renderURL var="viewCall">
<portlet:param name="mvcPath" value="/html/b.jsp"/> // path to your b.jsp
</portlet:renderURL>
<aui:button value="back" type="button" onClick="<%= viewCall%>" />
Also, in case you want to submit a form through AUI script you can use -
<aui:form name="viewDisplayd" method="post">
<aui:input type="button" value="back" name="hello" onclick="viewFun()"></aui:input>
</aui:form>
<aui:script>
function viewFun(){
submitForm(document.<portlet:namespace />viewDisplayd);
}
</aui:script>
Regards,
Atin Agarwal
I have to navigate from one jsp to another by using button. for that reason I just created an action class in which I can jump dynamically
If you simply want to navigate from one jsp to another then there is no need to use action URL , you can simply use render URL for that.
Suppose you want to navigate from a.jsp to b.jsp then simply use the following code on your a.jsp -
<portlet:renderURL var="viewCall">
<portlet:param name="mvcPath" value="/html/b.jsp"/> // path to your b.jsp
</portlet:renderURL>
<aui:button value="back" type="button" onClick="<%= viewCall%>" />
Also, in case you want to submit a form through AUI script you can use -
<aui:form name="viewDisplayd" method="post">
<aui:input type="button" value="back" name="hello" onclick="viewFun()"></aui:input>
</aui:form>
<aui:script>
function viewFun(){
submitForm(document.<portlet:namespace />viewDisplayd);
}
</aui:script>
Regards,
Atin Agarwal
Edwin Lobo, modifié il y a 7 années.
RE: submit form by using javascript and using alloy ui tag
New Member Publications: 10 Date d'inscription: 05/05/16 Publications récentesAtin Agarwal:
Also, in case you want to submit a form through AUI script you can use -
<aui:form name="viewDisplayd" method="post">
<aui:input type="button" value="back" name="hello" onclick="viewFun()"></aui:input>
</aui:form>
<aui:script>
function viewFun(){
submitForm(document.<portlet:namespace />viewDisplayd);
}
</aui:script>
Hi Atin,
Can I send an aui:form value to the viewFun() Javascript function?
<aui:form action="viewFun()" name="<portlet:namespace />fm">
<aui:form name="<portlet:namespace />fm" method="post">
<aui:input name="hello" label="hello"></aui:input>
<aui:button type="submit"></aui:button>
</aui:form>
<aui:script>
function viewFun(){
var hello = <% ParamUtil.getString(request, "hello");%>;
}
</aui:script>
</aui:form>
How to do something like that?
Santosh B Biradar, modifié il y a 6 années.
RE: submit form by using javascript and using alloy ui tag
Junior Member Publications: 41 Date d'inscription: 04/08/15 Publications récentes
Hi Asif,
If you want to redirect from one jsp page to another jsp then yo should use liferay Render Url in ur jsp page.
And If you want jump from Action class to Jsp then you should use actionResponse.setRenderParametes("","") and there you should provide you key and valule pair[mvcPath , and Your path of you jsp]
Its very late reply but , it will help to somebody
Regards
Santosh B B
If you want to redirect from one jsp page to another jsp then yo should use liferay Render Url in ur jsp page.
And If you want jump from Action class to Jsp then you should use actionResponse.setRenderParametes("","") and there you should provide you key and valule pair[mvcPath , and Your path of you jsp]
Its very late reply but , it will help to somebody
Regards
Santosh B B