PDA

View Full Version : success:true, display message



millenium
13 May 2007, 6:28 AM
Hi all :),

I try to finish a registration form by sending the datas to php and to display "registration ok" on my page after that "success" is sending back from php.

In the code below it's my code for the submit button and php (second code) sends well "success:true" (viewable in the console)

But i don't know where i can use the value of success to display "registration ok", with which action.

1) Does somebody have a small example on how to do that?
2) secondly, all the sent variables from php to ext must be with {}?

Sorry for my english (i'm belgian)

Thanks in advance,


var submit = form_member.addButton({
text: 'Inscription',
disabled:false,
handler: function(){
if(form_member.isValid()){
form_member.submit({url:'verif_insc.php', waitMsg:'Inscription en cours...'});
}
}
});


<?php
echo "{success:true}";
?>

jsakalos
13 May 2007, 6:33 AM
This is unabbreviated part of my form submit. Your mileage may vary.


this.form.submit({
params: Ext.apply({}, this.dataSource.baseParams, {
cmd: 'delete'
, id: record.id
})
, scope: this
, success: function(from, action) {
// put your message here
this.toolbar.setWait(false);
this.dataSource.remove(record);
}
, failure: function(form, action) {
this.toolbar.setWait(false);
Ext.Msg.minWidth = 360;
Ext.Msg.alert(
this.saveFailedText,
'<div class="prs-msg-critical">'
+ this.serverReasonText
+ ": <br /><b>" + action.result.errors
+ "</b></div>"
);
}
});

millenium
13 May 2007, 6:55 AM
Yesss, it works for me :D

For people who would be interested, here is my code, easier than yours, mine is for noobs lol

[CODE] var submit = form_member.addButton({
text: 'Inscription',
disabled:false,
handler: function(){
if(form_member.isValid()){
form_member.submit({
url:'verif_insc.php',
waitMsg:'Inscription en cours...',
success: function(form, action) {
Ext.Msg.alert('Merci', 'Inscription r