wkempees
|
Posted: 03/03/2006, 1:02 AM |
|
Asked frequenrly:
The GetValue() RadioButton will return the index of the checked RadioButton
in the array, so you can test which one was checked.
The SetValue(2) will "check" the 2nd RadioButton, so you can set the desired
box to "checked".
The RadioButtons are (like Listboxes) populated with Bound/TextColumns
either from a database table or a ListofValues.
Effectively resulting in a mutlidimensional array(index, value).
So, and you'll have to do a lot by yourself, In the properties of your
RadioButton, BeforeShow you can
Following is a RadioButton based on Intranet example database, table TYPES
//empsSearch_RadioButton1_BeforeShow @79-FC6E5957
function empsSearch_RadioButton1_BeforeShow(& $sender)
{
$empsSearch_RadioButton1_BeforeShow = true;
$Component = & $sender;
$Container = CCGetParentContainer($sender);
global $empsSearch; //Compatibility
//End empsSearch_RadioButton1_BeforeShow
//Custom Code @81-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
$oldvalues = $Component->Values; // store the content of the array in a
tempvariable
if ($Component->Values[3][1] == "Question") // test for a specific
content
$Component->Values[3][1] = "Answer"; // set a desired value for
the third Radiobutton's value[1] as index = the [0] part.
//End Custom Code
//Close empsSearch_RadioButton1_BeforeShow @79-D256A801
return $empsSearch_RadioButton1_BeforeShow;
}
//End Close empsSearch_RadioButton1_BeforeShow
Tested.
Of course there are many ways to test the content of an array and change
it, checout the PhP manuals on array and array handling.
But this should answer your question.
BTW
if you want to display the content of the array for debugging purposes:
print_r( $Component->Values );
Walter
Anyone more elaborate solution, please do!
|