• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Ajax Form submit

Ajax Form submit 12 years 1 month ago #19516

  • czareknster
  • czareknster's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 4
Hi, if you want submit your form with Ajax, You can easily do this with jQuery form plugin and couple line of code.

ajaxSubmit

In javascript window add this:
<script type="text/javascript" src="/templates/[YOUR_TEMPLATE]/javascript/formplugin.js"></script>
<script>
jQuery(function($){
$(document).ready(function() { 
    var options = { 
        beforeSubmit:  showRequest,
        success: showResponseAll   
        }; 
 
    // bind to the form's submit event 
    $('#userForm').submit(function() { 
        $(this).ajaxSubmit(options); 
        return false; 
    }); 
}); 
 
// pre-submit callback 
function showRequest(formData, jqForm, options) { 
  $('.my-message').html("Loading....");
    return true; 
} 
 
// post-submit callback
function showResponseAll(responseText, statusText, xhr, $form)  {
      var $response = $(responseText);
      var comon = $response;
      var dane = comon.find('.message-load')   
      $('.my-message').html(dane);
} 
 
});
</script>

In html formLayout add modify to this:
<div class="my-message"></div>
<div class="componentheading">{global:formtitle}</div>
<div class="message-load">{error}</div>
Last Edit: 12 years 1 month ago by czareknster.
The administrator has disabled public write access.
The following user(s) said Thank You: anthony.burge, chrisjclay3, george.d19, vladimirvnr

Ajax Form submit 10 years 2 weeks ago #29326

  • 7723
  • 7723's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Dear, czareknster.

This solution does not work :( Maybe I need to modify some lines in the default formplugin.js?

Can you help me with more info about AJAX submit in RSForm PRO?
The administrator has disabled public write access.

Ajax Form submit 10 years 2 weeks ago #29334

Hi all,

I need help too, i tried to follow this solution but i was unable to make it work.
I have a "slidding" vertical website and it's really anoying to refresh the page after submiting the form.

Regards,
Miguel Braga
The administrator has disabled public write access.

Ajax Form submit 9 years 11 months ago #29697

Hey there,

You can grab the plugin here: github.com/malsup/form/

Just as a test I'd advise you create a basic form with a single text field and a submit button.

Once you have uploaded the plugin to your website link it in to the form by going inside that form then:

Properties
-> CSS and Javascript

then inside the Javascript part have something like:

<script src="ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="www.yoursite.com/*changethis*/jquery.form.js"></script>

<script>
jQuery(function($){
$(document).ready(function() {
var options = {
beforeSubmit: showRequest,
success: showResponseAll
};

// bind to the form's submit event
$('#userForm').submit(function() {
$(this).ajaxSubmit(options);
return false;
});
});

// pre-submit callback
function showRequest(formData, jqForm, options) {
$('.my-message').html("Loading....");
return true;
}

// post-submit callback
function showResponseAll(responseText, statusText, xhr, $form) {
var $response = $(responseText);
var comon = $response;
var dane = comon.find('.message-load')
$('.my-message').html(dane);
}

});
</script>

Then go to the FormLayout and Turn Off the Auto Generate Layout

Replace {error} at the top with:

<div class="my-message"></div>
<div class="componentheading">{global:formtitle}</div>
<div class="message-load">{error}</div>

Now save the form and preview it.

From here when you hit submit it should submit the form but the page doesn't refresh.

So just to be sure it worked... check your submissions for that form.

For me my submissions updated correctly so great plugin!
The administrator has disabled public write access.

Ajax Form submit 9 years 10 months ago #29847

  • kapets
  • kapets's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 1
in case if you want to show thx message, then you should do the following:
insted of this
Warning: Spoiler! [ Click to expand ]


you should use this
Warning: Spoiler! [ Click to expand ]
The administrator has disabled public write access.
The following user(s) said Thank You: esedic

Ajax Form submit 9 years 5 months ago #31411

  • badimba
  • badimba's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 25
  • Thank you received: 3
Missing code from above:

// pre-submit callback
function showRequest(formData, jqForm, options) {
// $('.my-message').html("Loading....");
return true;
}


// pre-submit callback
function showResponseAll(responseText, statusText, xhr, $form) {
var $response = $(responseText);
var comon = $response;
var dane = comon.find('.message-load');

if($('.message-load').find('div').is(':hidden')) {
$('.my-message').html('THX Message');
}

And this still didn't work for me. Think becuase I'm calling mine from inside a slider.
Last Edit: 9 years 5 months ago by badimba. Reason: Addition
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!