PDA

View Full Version : confirmation before select radio buttion from Radiogroup



saurabh.find
3 Apr 2011, 10:45 AM
i have radio group with two radio button before change the value of radio button i have to show confirm box. following code i am using ::
this is code is working fine in case of 'yes'. but getting problem in case of 'No'. when i press on 'No' it should be toggle the radio button selection. m getting to much problem please help.



<html>
<head>
<link rel="stylesheet" type="text/css" href="css/ext-all.css" />
<script src="javascript/ext-base.js"></script>
<script src="javascript/ext-all.js"></script>
</head>
<body>
<div id="gradingSystem"></div>
<div id="pointGradingSystem"></div>
<div id="degreeGradingSystem"></div>
<script>
var PointSystem;
var DegreeSystem;
Ext.onReady(function(){
PointSystem = new Ext.Panel( {
renderTo : 'pointGradingSystem',
title : 'Point System',
collapsible : true,
bodyStyle : 'padding:10px',
items : [ {
layout : 'Column',
border : false,
items : [

]
}]
});

DegreeSystem = new Ext.Panel( {
renderTo : 'degreeGradingSystem',
title : 'Degree System',
collapsible : true,
hidden:true,
bodyStyle : 'padding:10px',
items : [ {
layout : 'Column',
border : false,
items : [

]
}]
});



var westPn = new Ext.Panel( {
renderTo : 'gradingSystem',
title : 'Grading System',
collapsible : true,
bodyStyle : 'padding:10px',
items : [ {
layout : 'Column',
border : false,
items : [
new Ext.form.RadioGroup({
fieldLabel: 'Main Phone',
vertical: false,
id:"mainPhone",
items: [
{boxLabel: 'Yes/No',id:'pointRad', name: 'id-1', inputValue: 'point', checked:true},
{boxLabel: 'degree',id:'degreeRad', name: 'id-1', inputValue: 'degree'}

],
listeners: {
change: function(radiogroup, radio) {
console.info(radiogroup);
console.info(radio.inputValue);
switch(radio.inputValue){
case 'point':degreeToPoint();break;
case 'degree':pointToDegree();break;
}
}
}

})

]
}]
});

});

function pointToDegree(){
Ext.MessageBox.show({
title:'Confirm?',
msg: 'Change Point To Degree?',
buttons: Ext.MessageBox.YESNO,
fn: changePointToDegree,
icon: Ext.MessageBox.INFO
});
}
function degreeToPoint(){
Ext.MessageBox.show({
title:'Confirm?',
msg: 'Change degree To Point?',
buttons: Ext.MessageBox.YESNO,
fn: changeDegreeToPoint,
icon: Ext.MessageBox.INFO
});
}

function changePointToDegree(val){
if(val=='no'){
alert('Reset the radio check seletion Degree To Point');
//Ext.getCmp('mainPhone').reset();
Ext.getCmp('degreeRad').setValue(1);

}else
{
PointSystem.hide();
DegreeSystem.show();
}

}
function changeDegreeToPoint(val){
if(val=='no'){
alert('Reset the radio check seletion Point To Degree');
//Ext.getCmp('mainPhone').setValue([false, true]);

}
else
{
PointSystem.show();
DegreeSystem.hide();
}

}
</script>
</body>
</html>


any body can help me: