I could not find how to do this in the help files for appgini so here is how I did it.
I wanted radio button to display side by side rather than vertical for a number of reason. Look mostly after I revised the template file.
Here is how to do it with an actual code from a project of mine. Open up the tablename_dml.php file and look for the following:
function clinic_reg_form($selected_id = '', $AllowUpdate = 1, $AllowInsert = 1, $AllowDelete = 1, $ShowCancel = 0){
// function to return an editable form for a table records
// and fill it with data of record whose ID is $selected_id. If $selected_id
// is empty, an empty form is shown, with only an 'Add New'
// button displayed.
Then further down look for the name of your field in the table: I am using year_level_obtained. I want the years to be side by side, not vertical to fit in my design better. The line in red is the one which controls how many radio buttons are shown per line. Since I revise the template files for a better look I need the radio buttons spread out wider on the page.
$combo_year_level_obtained = new Combo;
$combo_year_level_obtained->ListType = 0;
$combo_year_level_obtained->MultipleSeparator = ', ';
$combo_year_level_obtained->ListBoxHeight = 10;
$combo_year_level_obtained->RadiosPerLine = 4;
if(is_file(dirname(__FILE__).'/hooks/clinic_reg.year_level_obtained.csv')){
$year_level_obtained_data = addslashes(implode('', @file(dirname(__FILE__).'/hooks/clinic_reg.year_level_obtained.csv')));
$combo_year_level_obtained->ListItem = explode('||', convertLegacyOptions($year_level_obtained_data));
$combo_year_level_obtained->ListData = $combo_year_level_obtained->ListItem;
}else{
$combo_year_level_obtained->ListItem = explode('||', convertLegacyOptions("Never;;Prior to 2007;;2007;;2008;;2009;;2010;;2011"));
$combo_year_level_obtained->ListData = $combo_year_level_obtained->ListItem;
}
$combo_year_level_obtained->SelectName = 'year_level_obtained';
$combo_year_level_obtained->AllowNull = false;
One more thing, while I am at it, if you find that a radio button named 'None' shows up you can get rid of it by adding the AllowNull line to the code at the end of this string. See the last line above. Change year_level_obtained to your field name. If I have multiple files I need to change then I use a program which searches for all instances and allows me to change them in one go. On the macintosh I use BBedit.
Hope someone finds this useful.
Alan
Making radio buttons display side by side
Making radio buttons display side by side
Calgary, Alberta, Canada - Using Appgini 5.50 -
Re: Making radio buttons display side by side
Very useful
Thanks Alen.
Thanks Alen.
Re: Making radio buttons display side by side
thanks Alan for sharing this!
Re: Making radio buttons display side by side
hello
thanks a lot
but i think you should change
$combo_year_level_obtained->ListType = 0;
to
$combo_year_level_obtained->ListType = 2;
Drop-Down list = 0
Multiple-choice list box =1
Radio Buttons = 2
thanks a lot
but i think you should change
$combo_year_level_obtained->ListType = 0;
to
$combo_year_level_obtained->ListType = 2;
Drop-Down list = 0
Multiple-choice list box =1
Radio Buttons = 2
Re: Making radio buttons display side by side
shall I put the line in red in between this code?
function Property_init(&$options, $memberInfo, &$args){
return TRUE;
function Property_init(&$options, $memberInfo, &$args){
return TRUE;
Re: Making radio buttons display side by side
This is not a hook function. You just need to edit one line in the generated your-table-name.dml file (where your-table-name is the actual name of your table)
Find the code in your-table-name.dml that looks like this, for the particular field with the radio buttons (where your-field-name is the actual name of your field)
Then just edit the number you see in this line:
$combo_your-field-name->RadiosPerLine = 1;
If you want 5 radio buttons per line, just edit to:
$combo_your-field-name->RadiosPerLine = 5;
Find the code in your-table-name.dml that looks like this, for the particular field with the radio buttons (where your-field-name is the actual name of your field)
Code: Select all
// combobox: your-field-name
$combo_your-field-name = new Combo;
$combo_your-field-name->ListType = 2;
$combo_your-field-name->MultipleSeparator = ', ';
$combo_your-field-name->ListBoxHeight = 10;
$combo_your-field-name->RadiosPerLine = 1; <= YOU NEED TO EDIT THIS LINE
if(is_file(dirname(__FILE__).'/hooks/your-table-name.your-field-name.csv')){
$your-field-name_data = addslashes(implode('', @file(dirname(__FILE__).'/hooks/your-table-name.your-field-name.csv')));
$combo_your-field-name->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions($your-field-name_data)));
$combo_your-field-name->ListData = $combo_your-field-name->ListItem;
}else{
$combo_your-field-name->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions("1;;2;;3;;4;;5;;6;;7;;8;;9;;10")));
$combo_your-field-name->ListData = $combo_your-field-name->ListItem;
}
$combo_your-field-name->SelectName = 'your-field-name';
$combo_your-field-name->RadiosPerLine = 1;
If you want 5 radio buttons per line, just edit to:
$combo_your-field-name->RadiosPerLine = 5;
Re: Making radio buttons display side by side
thanks. I got it!
Re: Making radio buttons display side by side
I find that if I saved this setting and restart the computer, My setting will clear up, how can I fix this problem?