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



Comments

  1. For :


    VAR 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[

    ReplyDelete
    Replies
    1. Hi Jarod,

      I have updated the post. Please try again by copying the above Code. I will work.

      Delete
  2. When 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?

    ReplyDelete
  3. Just to add [Liferay form submission example][1] http://www.iseebug.com/wiki/

    ReplyDelete
  4. Great post! I am actually getting ready to across this information which I found very interesting to read. 
    dissertation Writing Service

    ReplyDelete

Post a Comment

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate