Hi,
I have an issue that i cannot get solved.
Basically i have an form, which sends a mail to the email address we type in the email field from a formpanel.
Here is what i have:
Code:
Ext.define('BeautifulMinds.view.patientCGconnect', {
extend: 'Ext.form.Panel',
alias: 'widget.patientcgconnect',
config: {
itemId: 'patientcgconnect',
scrollable: false,
items: [
{
xtype: 'container',
centered: true,
height: '100%',
html: '<img src="./images/backgrounds/patients/Backgrounds_only_Patients-27.png" style="width:100%; height:100%" />',
left: 0,
top: 0,
width: '100%'
},
{
xtype: 'button',
baseCls: 'x-transparent',
height: '15%',
html: '<img src="./images/patients/find a dr/home.png" style="width:100%; height:100%" />',
id: 'backhomepatient',
left: '39%',
top: '-6%',
width: '22%',
zIndex: 3
},
{
xtype: 'button',
baseCls: 'x-transparent',
height: '8%',
html: '<img src="./images/patients/find a dr/back.png" style="width:100%; height:100%" />',
id: 'backpconect',
left: '1%',
top: '1%',
width: '15%',
zIndex: 3
},
{
xtype: 'image',
bottom: '-10.5%',
height: '16%',
html: '<img src="./images/patients/find a dr/footer.png" style="width:100%; height:100%" />',
right: '5%',
width: '25%'
},
{
xtype: 'emailfield',
height: '10%',
itemId: 'ptcaregivermail',
left: '16%',
top: '30%',
width: '68%',
zIndex: 2,
label: 'Invite your Care Giver',
labelAlign: 'top',
labelWidth: 'auto',
name: 'ptcaregivermail',
placeHolder: 'ENTER HERE THE MAIL OF YOUR CARE GIVER'
},
{
xtype: 'button',
baseCls: 'x-transparent',
height: '8%',
html: '<img src="./images/patients/suggestions/submit-button.png" style="width:100%; height:100%" />',
id: 'ptinvitecg',
left: '78%',
top: '68%',
width: '13%',
zIndex: 3
}
]
}
});
I Handle the submit (tap on #ptinvitecg button) with a controller.
Code:
var varlog = null;
varlog = this.getPatientcgconnect().getValues();
alert(varlog.ptcaregivermail);
Ext.Ajax.request({
url: 'connectcg.php',
params: {
mail: varlog.ptcaregivermail,
user: localStorage.getItem('username')
},
success: function(result) {
var responseText = result.responseText;
if (responseText.trim() === "success"){
Ext.Msg.alert('', 'Invite sent to your Care Giver');
button.up('navigationview').push({
xtype: 'pmenu'
});
}else if (responseText.trim() === "failed1"){
Ext.Msg.alert("", "Server error, please try again later.1");
}else if (responseText.trim() === "failed2"){
Ext.Msg.alert("", "Server error, please try again later.2");
}
},
failure: function(){
Ext.Msg.alert("Could not connect to server.");
}
});
The problem is that the first time works good, but then if i come back to the form, everything looks good like the first time, but when i "submit" only the new value is not showing but only the one from the first submit.
Here is how i access the page from a controller
Code:
onPTCGConnectTap: function(button, e, options) {
button.up('navigationview').push({
xtype: 'patientcgconnect'
});
},
Thanks to the one who can give me a viable solution. Because i tried a lot of them to use the famous reset() method but nothing worked.