ext4phil
20 Sep 2007, 1:54 AM
Hello to you all,
I have writen the below code as I am trying to understand how the success/failure callback functions get called
when my PHP returns {success:true} the success callback runs as expected
when my PHP returns {success:false} then I get stuck with the waitMsg: 'Testing, please wait...'
what must I do to have the failure callback run.
HTML Code
<html>
<head>
<script src="yui-utilities.js" type="text/javascript"></script>
<script src="ext-yui-adapter.js" type="text/javascript"></script>
<script src="ext-all-debug.js" type="text/javascript"></script>
<script src="FormTest01.js" type="text/javascript"></script>
<link href="./css/ext-all.css" media="screen" rel="Stylesheet" type="text/css" />
</head>
<body>
<div id="myForm"></div>
</body>
</html>
JS Code
Ext.onReady(function(){
var simple = new Ext.form.Form();
simple.addButton(
{
text: 'Test',
handler: function() {
simple.submit(
{
waitMsg: 'Testing, please wait...',
url:'./FormTest01.php',
params:{param01:"01", param02:"02"},
success:function(form, action) {
alert('Congrats! success!');
},
failure: function(form, action) {
alert('Oops failure!');
}
}
);
}
}
);
simple.render('myForm');
});
PHP Code
<?php echo("{success:true}"); ?>
I have writen the below code as I am trying to understand how the success/failure callback functions get called
when my PHP returns {success:true} the success callback runs as expected
when my PHP returns {success:false} then I get stuck with the waitMsg: 'Testing, please wait...'
what must I do to have the failure callback run.
HTML Code
<html>
<head>
<script src="yui-utilities.js" type="text/javascript"></script>
<script src="ext-yui-adapter.js" type="text/javascript"></script>
<script src="ext-all-debug.js" type="text/javascript"></script>
<script src="FormTest01.js" type="text/javascript"></script>
<link href="./css/ext-all.css" media="screen" rel="Stylesheet" type="text/css" />
</head>
<body>
<div id="myForm"></div>
</body>
</html>
JS Code
Ext.onReady(function(){
var simple = new Ext.form.Form();
simple.addButton(
{
text: 'Test',
handler: function() {
simple.submit(
{
waitMsg: 'Testing, please wait...',
url:'./FormTest01.php',
params:{param01:"01", param02:"02"},
success:function(form, action) {
alert('Congrats! success!');
},
failure: function(form, action) {
alert('Oops failure!');
}
}
);
}
}
);
simple.render('myForm');
});
PHP Code
<?php echo("{success:true}"); ?>