View Full Version : Execute PHP function on button clic event
janixams
22 Jun 2008, 2:45 PM
Hi all,
I need to execute a PHP function when the user click YES in a Yes/No dialog. I think this is not possible, but I am not sure.
I have this code:
[PHP]Ext.Msg.show({
title:'Atenci
jay@moduscreate.com
22 Jun 2008, 3:22 PM
use Ext.ajax.request
NoahK17
23 Jun 2008, 2:06 PM
// Show a dialog using config options:
Ext.Msg.show({
title:'Save...',
msg: 'You are about to save over your current workspace. Would you like to continue?',
buttons: Ext.Msg.YESNOCANCEL,
fn: Ext.ws.processResultWorkspace,
animEl: 'header',
icon: Ext.MessageBox.QUESTION,
scope:this
});
Ext.ws.processResultWorkspace = function(e){
if(e == 'yes'){
var saveData = new Ext.data.Connection().request({
url: '/repository/libs/php/save-workspace.php',
params: {data: "123", action: "save"},
failure: Ext.ws.saveWorkspaceFail,
success: Ext.ws.saveWorkspaceSuccess,
});
}
}
Does that make sense? You check to see if the user clicked YES. If so, we send an AJAX request to an external PHP page. Then we define two call-back functions, saveWorkspaceFail and saveWorkspaceSuccess... which we then do whatever we wish.
Good luck!
janixams
23 Jun 2008, 7:10 PM
Thanks you so much.
I'll try with your code.
Thanks again. :)
janixams
23 Jun 2008, 7:42 PM
Forgive my ignorance.
I try your code but firebug shows "Ext.ws has no properties".
What I am doing wrong? :-/
Thanks for your help.
janixams
23 Jun 2008, 9:26 PM
use Ext.ajax.request
I try the first way. Here is the code:
[PHP]Ext.Msg.show({
title:'Atenci
jay@moduscreate.com
24 Jun 2008, 6:30 AM
http://extjs.com/learn/Manual:Core:Ext.Ajax
NoahK17
25 Jun 2008, 8:26 AM
Ext.ws is a namespace I created. Try taking out the .ws
janixams
27 Jun 2008, 7:18 AM
I am trying this:
[PHP]
Ext.Msg.show({
title:'Confirmaci
diplopito
30 Jun 2008, 3:50 AM
Try:
if (valor)
Hope it helps:-)
xmart2k
9 Jul 2008, 5:46 AM
or try
<?php
echo '{"resp":"true"}';
?>
Elwood_76
20 Jul 2008, 7:55 AM
Prueba sin las commilas simples , es decir
valor ==true
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.