PDA

View Full Version : radio buttons with valence ?


ThierryC
12-08-2009, 12:21 PM
Hi..
i'm looking for the best way to for working with radio buttons in combination with valence..
see my (non-working) example..
do you have an example?, or can you tell what's wrong with my sample
do you need to specify an id for every single option, or can is it possible to retrieve only the outcome from the selection with 1 command.
and how does this need to be retrieved in Rpg (vvin_char/vvin_num?)


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Copyright" content="Copyright � 2008-2009 CNX Corporation, All Rights Reserved">
<title>TEST OPEN IFS</title>
<link rel="stylesheet" type="text/css" href="/extjs/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/vvresources/valence.css" />
<script type="text/javascript" src="/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/extjs/ext-all.js"></script>
<script type="text/javascript" src="/vvresources/valence.js"></script>
<script type="text/javascript">
Ext.onReady(function() {

var callRPG = function() {
test = Ext.getCmp('Download_Y').getValue();
console.log(test);
test = Ext.getCmp('Download_N').getValue();
console.log(test);

Ext.Ajax.request({
url: 'vvcall.pgm',
params: {
pgm: 'CM_COGP63R',
action: 'OpenFile',
Filename: Ext.get('Filename').getValue(),
Path : Ext.get('Path').getValue(),
Download_N: Ext.getCmp('Download_Y').getGroupValue()
}
});
};

var panelMain = new Ext.form.FormPanel({
frame: true,
header: true,
labelAlign: 'right',
labelWidth: 175,
title: 'CM_COGP63R Test open Ifs docs in browser',
width: 475,
items: [{
xtype: 'textfield',
id: 'Path',
name: 'Path',
fieldLabel: 'Enter path',
width: 275
}, {
xtype: 'textfield',
id: 'Filename',
name: 'Filename',
fieldLabel: 'Enter filename',
width: 275
}, {
xtype: 'radio',
fieldLabel: 'Download',
name: 'Download',
id: 'Download_Y',
boxLabel: 'Y',
checked: true,
value: 'Y'
}, {
xtype: 'radio',
hideLabel: false,
labelSeparator: '',
id: 'Download_N',
name: 'Download',
value: 'N',
boxLabel: 'N'
} ],
buttons: [{
text: 'Go',
id: 'buttonGo',
name: 'buttonGo',
handler: callRPG
}, {
text: 'Clear fields',
iconCls: 'cancel',
handler: function(){
Ext.getCmp('Filename').setValue('');
Ext.getCmp('Path').setValue('');
}
//Ext.getCmp('Download_Y').setValue(true);
//Ext.getCmp('Download_N').setValue(false);
}
}
]
});

panelMain.render(document.body);

});
</script>
</head>
<body>
</body>
</html>

sean.lanktree
12-08-2009, 12:27 PM
When submitting your selections to the back-end program, I would only send back the value of one of the radio buttons (since there are only two and only one can be selected).

When pulling in the value from the backend, it should look something like this:


d post_Download s n

/free
post_Download = (vvIn_char('Download_Y')='true');

if post_Download;
// then download
else;
// no download
endif;

ThierryC
12-08-2009, 12:30 PM
ok, thx Sean;

i'll try immediately