问题
I have a form in my page. I want the form details, which are filled by user, to send on a particular email.
Here is my Form:
xtype: 'formpanel',
width: 300,
height: 900,//recommended for the build
url: 'contact.php',
scrollable:false,
items:[
{
xtype: 'textfield',
name : 'name',
label: 'Name',
labelWidth:100
},
{
xtype: 'textfield',
name : 'Date of birth',
label: 'Date of birth',
maxLength: 10,
labelWidth:120
},
{
xtype: 'textfield',
name : 'Nationality',
label: 'Nationality',
labelWidth:100
},
{
xtype: 'textfield',
name : 'City of Residence',
label: 'City of Residence',
labelWidth:170
},
{
xtype: 'textfield',
name : 'Country',
label: 'Country',
labelWidth:100
},
{
xtype: 'textfield',
name : 'Date',
label: 'Starting date of this course',
labelWidth:220
},
{
xtype: 'fieldset',
title: '3. Course to join',
items: [
{
xtype: 'selectfield',
label: 'Choose one',
labelWidth:120,
options: [
{text: 'Ayurveda Massage (Ayurveda Yoga Massage)', value: 'first'},
{text: 'Ayur Balance Massage', value: 'second'},
{text: 'Abhyanga Massage with Shirodhara', value: 'third'}
]
}
]
},
{
xtype: 'numberfield',
name : 'Date',
label: 'Starting date of this course',
labelWidth:220
},
{
xtype: 'numberfield',
name : 'Your Phone',
label: 'Your Phone',
labelWidth:120
},
{
xtype: 'toolbar',
items: [
{
xtype: 'button',
height: 30,
text: 'Submit',
ui : 'confirm',
handler : function(button) {
this.up('formpanel').submit();
}
}
]
}
]
Here is my php script:
<?php
// Configuration Settings
$SendFrom = "Form Feedback <jainishan@yahoo.in>";
$SendTo = "ishan.fzd@gmail.com";
$SubjectLine = "Feedback Submission";
// Send E-Mail and Direct Browser to Confirmation Page
mail($SendTo, $SubjectLine, $MsgBody, "From: $SendFrom");
?>
On tap of form button, I am getting a following exception:
You're trying to decode an invalid JSON String:
Parse error: syntax error, unexpected '.=' (T_CONCAT_EQUAL) in E:\softwares\Sencha dwnlds\xampp\htdocs\RasovaiApp\contact.php on line 11
Note: "I am facing problem while sending email. I am not even able to send a basic email."
Any help would be greatful.
Thanks Ishan jain
回答1:
Instead of submitting it directly you can use form's getValues()
method to get form data and then format it as per your convenience. Look at this example : http://try.sencha.com/touch/2.0.1/demos/Ext.form.FormPanel.getValues/viewer.html
来源:https://stackoverflow.com/questions/16657005/email-form-detail-in-sencha-touch-giving-exception