|
 |
|
Codewalkers Forums
> Other Technologies
> Client Side Things
|
Javascript - Mootools submit stop event
Discuss Mootools submit stop event in the Client Side Things forum on Codewalkers. Mootools submit stop event Here is a place to talk and ask questions about HTML, CSS, Javascript, and other client side technologies.
|
|
|
|
 |
|
|
|
|

Codewalkers Forums Sponsor:
|
|
|

January 22nd, 2013, 03:24 PM
|
|
Registered User
|
|
Join Date: Oct 2012
Posts: 12
Time spent in forums: 3 h 8 m 24 sec
Reputation Power: 0
|
|
|
Javascript - Mootools submit stop event
well,i have this script that i have set up that on submit requests php file that is used to validate my input values...i have set up that when it is not validated the correct way to echo it is not validated,now i want in my request when i get response and it is the error response to stop the submit..here is the script,it does send the request and returns response but it doesnt stop the submit...
window.addEvent('domready', function(){
var form=document.adminForm;
form.addEvent('submit', function(e){
var dataString="date=" + document.getElementById("date").value + "&start=" + document.getElementById("start").value + "&end=" + document.getElementById("end").value;
var requestData = new Request ({
url: '/provjera.php',
method:'POST',
async:false,
evalResponse:true,
data:dataString,
onComplete: function(responseText){
alert(responseText);
if(responseText){}
e.stop();
}
});
requestData.send();
});
});
|

January 23rd, 2013, 04:05 AM
|
 |
Contributing User
|
|
Join Date: Apr 2007
Location: Galway
Posts: 1,369

Time spent in forums: 1 Month 4 h 23 sec
Reputation Power: 8
|
|
|
AFAIK once the submit is started it cant be cancelled, you could however just ignore the response if the error is returned?
Alternative would be to break out what happens when the submit is issued into several parts instead of just one.
__________________
When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
|

January 23rd, 2013, 08:33 AM
|
|
Registered User
|
|
Join Date: Oct 2012
Posts: 12
Time spent in forums: 3 h 8 m 24 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by DavidMR AFAIK once the submit is started it cant be cancelled, you could however just ignore the response if the error is returned?
Alternative would be to break out what happens when the submit is issued into several parts instead of just one. |
you misunderstood me,i dont wont to ignore the response...if response returns error i want to stop the submit,if it is ok to continue...
|

January 23rd, 2013, 08:43 AM
|
 |
Contributing User
|
|
Join Date: Apr 2007
Location: Galway
Posts: 1,369

Time spent in forums: 1 Month 4 h 23 sec
Reputation Power: 8
|
|
|
No, you misunderstand me, what i was saying was i dont think you can cancel the submit as its asynchronous, what i was saying is, if you had various steps you could use that approach.
not sure because I havent tried, but if the form had an "onsubmit='function()'" it might work,the response could be the error generated by the function, just use "return false" after the alert. but i havent tried this so not sure about this.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|