1. #1
    Sencha User
    Join Date
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Answers
    16
    Vote Rating
    1
    myput is on a distinguished road

      0  

    Default Unanswered: send param to php in form

    Unanswered: send param to php in form


    Hello,

    I have a list and in the detailPanel, i have a form. when the itemTap of the list coming, i build the form and send the email of the list store for the concerning item to the form.
    I would like when i treat the form in php, get the email from the build form function...
    Is it possible ?

    I tried:
    Code:
    addContactForm: function(email) {
    		var emailitem = email;
    		var contactFormPanel;
    		var formBase = {
    			scroll: 'vertical',
    			url: App.config.host + App.config.PhpPath + 'sendEmail.php',
    			standardSubmit : false,
    			items: [
    				{
    					xtype: 'fieldset',
    					items: [
    					{
    						xtype: 'textfield',
    						name: 'name',
    						label: App.config._ContactLabelName,
    					},
                                            ........................
    					]
    				}
    			],
    			dockedItems: [
    				{
    					xtype: 'toolbar',
    					dock: 'top',
    					items: [
                                                    .........................
    						{
    							text: App.config._ContactButtonSend,
    							ui: 'confirm',
    							handler: function() {
    								var model = ...
    									contactFormPanel.submit({
    										params: {
    											emailToSend: emailitem
    										},
    										success: function (frm, res) {
    											Ext.Msg.alert("", res.messageSend, Ext.emptyFn);
    											contactFormPanel.reset();
    										},
    									});
    								} 
    							}
    						}
    					]
    				}
    			]
    		};
    		contactFormPanel = new Ext.form.FormPanel(formBase);
    		return contactFormPanel;
    	},
    When i do an alert of: var emailitem = email; that's good, i have the good item email.

    But with:
    Code:
    										params: {											emailToSend: emailitem
    },
    The first time i'm coming in the form, the email is good, but when i come back to the list and choose another item and go to the contact form, the email in param keep the first email .... it doesn't take the new email variable ...

    this is a part of the php:
    PHP Code:
        $emailToSend $_POST['emailToSend'];    $name $_POST['name'];        $response = array('success' => true'messageSend' => 'send to: '.$emailToSend);    echo json_encode($response); 
    Email to send keep the same value that the first Item.

    Can you help me please?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    In your button handler the variable emailitem is correctly updated each time?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Answers
    16
    Vote Rating
    1
    myput is on a distinguished road

      0  

    Default


    No, and this is the problem ...
    At the beginning of the function, i have the good email,
    but when i'm coming in the validate handler, the email stay to the first Item ...

    In the console:
    Capture d’écran 2011-11-30 à 15.36.38.jpg

    A part of the code for the form:
    Code:
    	addContactForm: function(email) {
    		var emailitem = email;
    		console.log("START OF addContactForm:" + emailitem);
    		var contactFormPanel;
    		var formBase = {
    			url: App.config.host + App.config.PhpPath + App.config._FileEmailForm,
    			standardSubmit : false,
    			items: [ ...... EACH TEXTFIELD ],
    			dockedItems: [
    				{
    					xtype: 'toolbar', dock: 'top',
    					items: [
    						{
    							handler: function() {
    								console.log("START OF handler:" + emailitem);
                                                                    .... CHECK ERRORS
    								if(errors.isValid()) {
    									console.log("AFTER CHECK isValid:" + emailitem);
    									contactFormPanel.submit({
    										params: { emailToSend: emailitem },
    									});
    								} else {
    									........ 
    								}}}]}]
    		};
    		contactFormPanel = new Ext.form.FormPanel(formBase);
    		return contactFormPanel;
    	},
    I don't know why the variable loses the value in the handler ...
    Thanks by advance

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Answers
    16
    Vote Rating
    1
    myput is on a distinguished road

      0  

    Default


    up

  5. #5
    Sencha User
    Join Date
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Answers
    16
    Vote Rating
    1
    myput is on a distinguished road

      0  

    Default


    no idea ?

Thread Participants: 1