Form Submission Refresh Issue


(Tbaatar) #1

Hi,

 

I'm having problem creating form with instant feedback (success / error) using matrixjquery script.

The script works fine as intended but when there is an error and you submit the form again it will refersh the page weather it was success or not.

 

It seems on every subsequent submission the page refreshes. Here is a scenario:

 

1. User submits without completing the form, instant error message is showm

2. If user makes a mistake again or completes the form, page refreshes and goes back to the top.

3. If user tries to submit again (fail / complete), the ajax works and result is shown instantly

4. If for whatever reason if there was an error, and user tries again and succeeds or fails, the page refresh and goes back to the top.

 

What is Matrix exactly doing to ommit / disregard the Ajax code?

 

Thanks,

Tugu


(Nic Hubbard) #2

This is a script that you wrote? Or you got it from somewhere?


(Tbaatar) #3

I believe we are still using your Matrix Jquery:

 

/** * MySource Matrix Simple Edit Tools (jquery.matrix.js)
* version: 0.3.4 (OCT-18-2009)
* Copyright (C) 2009 Nicholas Hubbard
* @requires jQuery v1.3 or later
* @requires Trigger or Asset configuration in MySource Matrix
*
* Examples and documentation at: http://www.zedsaid.com/projects/simple-edit-tools
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/

 

It is doing very basic ajax submission:

// dynamic form send
$('#myform').matrixForm({
    loading: 'loading.gif', 
    findCreated: '#ajax-wrap',
    findTarget: '#ajax-wrap',
    noFade: true,
    onComplete: function() {       
    }
});

(Nic Hubbard) #4

 

I believe we are still using your Matrix Jquery:

 

 

Ha! :)

 

Do you have the page example that I can look at? I am thinking a JS error is causing this.


(Tbaatar) #5

I'll send across an email to you.

 

Thanks


(Tim Davison) #6

Nic - "...Or you got it from somewhere?"

Response - "Copyright © 2009 Nicholas Hubbard"

 

That's GOLD. Literally, tears of mirth.


(Nic Hubbard) #7

Nic - "...Or you got it from somewhere?"

Response - "Copyright © 2009 Nicholas Hubbard"

 

That's GOLD. Literally, tears of mirth.

 

:)


(Tbaatar) #8

Played around with other solutions and can't get it send without refresh.

 

How do you get around the Ajax url parameter with Matrix form?

 

 

$.ajax({ type : 'POST',
url : 'URL',
data : formData,
dataType : 'json',
encode : true
})


(Nic Hubbard) #9

Played around with other solutions and can't get it send without refresh.

 

How do you get around the Ajax url parameter with Matrix form?

 

 

URL param gets pulled from the form element. So just get the action attribute from the form and that will be the URL.