Gossamer Forum
Home : Products : DBMan : Customization :

Radio Button Checked

Quote Reply
Radio Button Checked
I am using the %db_radio_fields feature, and was wondering how to set it up so that one of the entries in the field is "checked".

The section from my .cfg file is:

# Radio fields. Field name => comma seperated list of radio buttons.
%db_radio_fields = ( Status => 'New,Changed,Pending' );

I would like "New" to be checked.

Thanks.


Alan Pollenz
Quote Reply
Re: Radio Button Checked In reply to
I think you can just add "New" as the default option for that field (in default.cfg).

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Radio Button Checked In reply to
Astro-Boy!!

I tried this previously, and of course it didn't work. But seeing your reply made me go back and look at the code some more.

I had modified the database definitions to include an additional field, which I named defaults2. I did this is order to use a slightly modified date that I called from a routine I named &get_adj_date. This returned a date 1 day previous to the current date.

Needless to say, when I put "New" in the default option, nothing happened, since sub html_add_form looks for defaults2 and not defaults. Putting "New" in the defaults2 field solved the problem.

Thanks.

Alan Pollenz
Quote Reply
Re: [AstroBoy] Radio Button Checked In reply to
Hi,
I must be rusty, but I don't get it: Do I put DEFAULT somewhere in the %db_radio_fields? Can you please show me exactly Blush how to get EUR checked?

I have
%db_radio_fields = (
'Currency' => 'EUR,USD'
);

I have tried to figure out what happens in build_radio_field, but I still don't understand the statement
$value =~ /^\Q$button\E$/

O grain
Quote Reply
Re: [O grain] Radio Button Checked In reply to
Hey o grain,

You would add it to the field definitions such as:

'Currency' => [11,'alpha',0,3,1,'EUR',''],

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Radio Button Checked In reply to
Thanks Lois,

I had tried that without success. Now I read the documentation on the sub more thoroughly: "Parameters are the column to build and a default value (optional)." So I tried to call it like

Code:

print &build_radio_field ("Currency","$default_currency");


(where $default_currency is set in the .cfg file) and that works fine. As far as I know I have the original sub...

Cheers,
O grain