Submitting the form with ajax(using alloy UI) i.e with out page refresh
In rare it may happens, you have to submit the form with out refresh the page (actionURL ) and save the parameters in the DB.
Jus Copy the below code , Here i am using alloy UI to submit the form and here not need to append any parametrs to the URL .you will get the parameters values from request parameters.
<portlet:actionURL var="formsubmissionURL" />
<aui:script use="aui-io-request,aui-node" >
Liferay.provide(window,'submitForm',
function() {
var A = AUI();
A.io.request('${formsubmissionURL}',{
method: 'POST',
form: { id: '<portlet:namespace />fm' },
on: {
success: function(){
}
}
});
});
</aui:script >
<aui:form action="#" method="POST" id="fm" name="fm" >
<aui:input type="text" name="name"/>
<aui:button type="submit" value="Save" />
</aui:form>
In Class:
String name = ParamUtil.getString("name","Venka");
That Its it done
For :
ReplyDeleteVAR A = AUI();
Liferay.provide(window,'submitForm',
function() {
A.io.request('${"formsubmissionURL"}',{
method: 'POST',
form: { id: 'FM' }
});
});
I'm always getting :
13:50:11,670 ERROR [http-bio-8080-exec-229][MinifierUtil:102] 187: 9: missing ; before statement
13:50:11,672 ERROR [http-bio-8080-exec-229][MinifierUtil:102] 1: 0: Compilation produced 1 syntax errors.
13:50:11,672 ERROR [http-bio-8080-exec-229][MinifierUtil:79] JavaScript Minifier failed for
// <![CDATA[
Hi Jarod,
DeleteI have updated the post. Please try again by copying the above Code. I will work.
It wokrs great...
ReplyDeleteThanks
DeleteWhen I have multiple forms in same jsp (tabs) , though I provide different ids and names for the forms, only one form is getting submitted when I try to submit the other forms. Could you please help me out with this?
ReplyDeleteJust to add [Liferay form submission example][1] http://www.iseebug.com/wiki/
ReplyDeleteGreat post! I am actually getting ready to across this information which I found very interesting to read.
ReplyDeletedissertation Writing Service
ilimZprur_n Shana Creedon https://takeoffwithustravels.wixsite.com/website/profile/Terjemahan-Kitab-Minhajul-Muslim-Pdf-719-VERIFIED/profile
ReplyDeletefrolictelpunc
YacidPhos_yo1993 Dave Douglas Install now
ReplyDeleteSlack
Eset NOD 32
Adobe After Effects
harebiswi