marc123
29 Jul 2012, 6:52 AM
Hi,
I have a loginForm, containing name/pw fields. As part of a Challenge-Handshake Authentication Protocol I also have a hidden field, the value of which contains random string (the challenge). That challenge is obtained from a webservice.
I have the loginform with hidden field and all.
My Q is: how can I populate the hiddenField with the value obtained from the webservice?
Can this be done without declaring a store and model? Seems overkill for just 1 field.
I hoped this was a configuration option but I can't figure out which.
My form:
var loginForm=Ext.create('Ext.form.Panel',{
standardSubmit: true,
//url:baseUrl+'remoteSecurityService.cfc?method=authenticate',
frame:true,
height:120,
defaults:{
width:300,
labelAlign:'right',
xtype:'textfield'
},
items:[{
xtype:'hiddenfield',
name:'token',
id:'tokenField'
},{
fieldLabel:'username',
name:'email'
},{
fieldLabel:'password',
name:'password',
inputType:'password'
}],
buttons:[{
text:'login',
handler:function(){
var theForm=this.up('form').getForm();
if(theForm.isValid()){
var formValues=theForm.getValues();
Ext.data.JsonP.request({
url:theForm.url,
method:'POST',
params:{
username:formValues.email,
tokenAndPasswordHash:formValues.password
},
callback:function(data){
alert(data.responseText);
}
});
}
}
}],
listeners:{
afterrender:function(theForm,action,opts){
var tokenField=theForm.getComponent('tokenField');
tokenField.update('http://cms.local/ws/remoteSecurityService.cfc?method=initchallenge')}
}
});
Thanks,
Marc
I have a loginForm, containing name/pw fields. As part of a Challenge-Handshake Authentication Protocol I also have a hidden field, the value of which contains random string (the challenge). That challenge is obtained from a webservice.
I have the loginform with hidden field and all.
My Q is: how can I populate the hiddenField with the value obtained from the webservice?
Can this be done without declaring a store and model? Seems overkill for just 1 field.
I hoped this was a configuration option but I can't figure out which.
My form:
var loginForm=Ext.create('Ext.form.Panel',{
standardSubmit: true,
//url:baseUrl+'remoteSecurityService.cfc?method=authenticate',
frame:true,
height:120,
defaults:{
width:300,
labelAlign:'right',
xtype:'textfield'
},
items:[{
xtype:'hiddenfield',
name:'token',
id:'tokenField'
},{
fieldLabel:'username',
name:'email'
},{
fieldLabel:'password',
name:'password',
inputType:'password'
}],
buttons:[{
text:'login',
handler:function(){
var theForm=this.up('form').getForm();
if(theForm.isValid()){
var formValues=theForm.getValues();
Ext.data.JsonP.request({
url:theForm.url,
method:'POST',
params:{
username:formValues.email,
tokenAndPasswordHash:formValues.password
},
callback:function(data){
alert(data.responseText);
}
});
}
}
}],
listeners:{
afterrender:function(theForm,action,opts){
var tokenField=theForm.getComponent('tokenField');
tokenField.update('http://cms.local/ws/remoteSecurityService.cfc?method=initchallenge')}
}
});
Thanks,
Marc