Gossamer Forum
Home : Products : DBMan : Installation :

Setting up checkbox fields, associating with select fields

(Page 1 of 2)
> >
Quote Reply
Setting up checkbox fields, associating with select fields
Hello. I have set up my database definition as follows:

Code:
%db_def = (
ID => [0, 'alpha', 10 , 10, 1, '', '' ],
dept => [1, 'alpha', 50 , 50, 1, '', '' ],
dept_desc => [2, 'alpha', '50x4', 150, 1, '', '' ],
practice => [3, 'alpha', 30 , 150, 1, '', '' ],
practice_desc => [4, 'alpha', '50x4', 150, 1, '', '' ],
first_name => [5, 'alpha', 20 , 50, 1, '', '' ],
middle => [6, 'alpha', 20 , 50, 0, '', '' ],
last_name => [7, 'alpha', 20 , 50, 1, '', '' ],
degree => [8, 'alpha', 50 , 150, 0, '', '' ],
title => [9, 'alpha', 50 , 150, 0, '', '' ],
type_of_practice => [10, 'alpha', 50 , 100, 1, '', '' ],
clinical_interests => [11, 'alpha', '50x4', 150, 1, '', '' ],
medical_school => [11, 'alpha', 50 , 150, 0, '', '' ],
residency => [12, 'alpha', '50x5', 250, 0, '', '' ],
fellowship => [13, 'alpha', 50 , 150, 0, '', '' ],
board_certification => [14, 'alpha', 50 , 150, 0, '', '' ],
other_training => [15, 'alpha', 50 , 150, 0, '', '' ],
graduate_school => [16, 'alpha', 50 , 150, 0, '', '' ],
clinical_training => [17, 'alpha', 50 , 150, 0, '', '' ],
certification => [18, 'alpha', 50 , 150, 0, '', '' ],
professional_assoc => [19, 'alpha', '50x3', 200, 0, '', '' ],
languages => [20, 'alpha', 50 , 150, 0, '', '' ],
practice_office => [21, 'alpha', 50 , 100, 1, '', '' ],
practice_location => [22, 'alpha', '50x2', 150, 1, '', '' ],
practice_phone => [23, 'numer', 14 , 14, 1, '(757) ', '' ],
practice_fax => [24, 'numer', 14 , 14, 0, '(757) ', '' ],
email => [25, 'alpha', 50 , 50, 0, '@evms.edu', '.+\@.+\..+' ],
academic_office => [26, 'alpha', 50 , 100, 0, '', '' ],
academic_location => [27, 'alpha', '50x2', 150, 0, '', '' ],
academic_phone => [28, 'numer', 14 , 50, 0, '(757) ', '' ],
after_hours_phone => [29, 'numer', 14 , 50, 1, '(757) ', '' ],
photo => [30, 'alpha', 50 , 90, 0, 'http://www.evms.edu/services/doctors/photos', '' ],
authorized_user => [31, 'alpha', 20 , 50, 1, '', '' ]
);

I want to be able to pre-enter the dept and practice descriptions so they will be
associated with the corresponding dept and practice, and will not appear on the add
record screen (I know I will need to make my own forms later). I want the author users to
be able to select a dept from a dropdown menu and then select one or more practices from a
list of checkboxes, and have the associated descriptions appear in the output of the
search. Can someone help me figure this out? Thanks.

Kim Lewandowski

[This message has been edited by kiml (edited August 09, 1999).]
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
 
Quote:
Are you using the autogenerate feature for your forms? If so, you should change the field length for your select list and checkboxes to 0.

Yes, I forgot about that; thanks. I'm using autogenerate for now, to make sure it works right, but I will need to make my own forms later.

Eliot mentioned using the build_fancy_select mod; how would that work?

Quote:
Also, you'll need to define a field for each of the checkboxes.

In the database definition, you mean? So each of the 18 practices will need its own field; I assume I should name the fields the same as the checkbox items.

Quote:
Are you saying that your descriptions will be created by the script and not by the person entering the data? If so, you don't need to have a field for them. We can set you up with a variable that will print out what you need.

Yes, the descriptions should be common to all the doctors within a dept/practice, so I don't want the auth users to have to enter them with each record; it would be easier if I could let the auth users modify them, but if necessary, I can do it myself. So they won't necessarily have to see them during data entry; they just need to select one or more checkboxes and the descriptions will be printed as part of the search results.

Thanks for your help.

Kim Lewandowski
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Can you give me a specific example? I'm having a little problem visualizing what you want to do.


------------------
JPD





Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Sure. I had a conversation with Eliot last week about it at http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000588.html (I guess that should have been in this forum, sorry). I referenced our current setup at http://www.evms.edu/services/phyrefdr.html.

Here's a summary: The database will be a list of physicians; guest users will be able to search the database, say for Family Practice, and the result will be all the doctors in the Family Practice dept. with their demographic info, along with a description of the Family Practice dept. Some of the doctors may be associated with more than one practice, within a dept, so I need a checkbox for the data input form, and if a user searches for Family Practice and Behavior, the result should be only the doctor(s) associated with both the dept and the practice.

There will be an authorized user for each dept who will be able to add, modify, and delete doctors; they should be able to select a dept from a dropdown list and one or more practices from a set of checkboxes. They will not need to see or modify the descriptions, but dept and practice descriptions need to be part of the database, so they can be part of a search result.

Last week, I had all the practices in one checkbox field, separated by commas, with the field name practice. After reading some messages about checkboxes, I thought I needed to change it to this:

Code:
# Checkbox fields. Field name => Checkbox value.
%db_checkbox_fields = ( practice1 => 'Behavioral Medicine',
practice2 => 'Geriatrics',
practice3 => 'Ghent Family Practice',
practice4 => 'Portsmouth Family Medicine',
practice5 => 'Weight and Well Being',
practice6 => 'General Internal Medicine/Primary Care - Hofheimer Hall',
practice7 => 'General Internal Medicine/Primary Care - DePaul Hospital',
practice8 => 'Cardiology',
practice9 => 'Dermatology',
practice10 => 'Endocrinology and Diabetes - Diabetes Institutes',
practice11 => 'Endocrinology and Diabetes - DePaul Endocrinology',
practice12 => 'Geriatrics - Hofheimer Hall',
practice13 => 'Geriatrics - Westminster Canterbury',
practice14 => 'Infectious Diseases',
practice15 => 'Pulmonary and Critical Care',
practice16 => 'Sleep Disorders - Sentara/EVMS Center - Norfolk',
practice17 => 'Sleep Disorders - Sentara/EVMS Center - South Hampton'

but it doesn't work; I get a text field and no checkboxes in the add screen.

I hope this is more helpful. Thanks.

Kim Lewandowski
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Are you using the autogenerate feature for your forms? If so, you should change the field length for your select list and checkboxes to 0.

Also, you'll need to define a field for each of the checkboxes.

Are you saying that your descriptions will be created by the script and not by the person entering the data? If so, you don't need to have a field for them. We can set you up with a variable that will print out what you need.


------------------
JPD





Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
I don't know that the "fancy" select field would do you much good.

Right. You need to have a field for each practice, named the same as the fields listed in the checkbox definition. Each one should have a field length of "0."

If you want those with admin permission to be able to edit the descriptions, you could make those "admin-only" fields by setting the field lengths to -2. While you're still using autogenerate, you won't get textareas. But you can set up "admin-only" fields when you create your own form.


------------------
JPD





Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
I'm not sure at this point; would it be possible to build in that capability now and maybe remove it later?

Kim Lewandowski
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Actually, I want the auth users to have author permission, able to add, modify and delete, but not add new users. Is there a code to indicate that in the .cfg file?

Thanks,
Kim Lewandowski
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Now I'm getting confused. (My normal state! Smile )

Can you tell me exactly what you want different people to be able to do?


------------------
JPD





Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
I want to have admin rights myself (I will probably be the only one), to add new authorized users who will have author rights (maybe I'm not using the right term here): they will be able to view, add, modify, and delete records. Then I will have a default user who will not have to login (I will use a link to get them to the search screen) and will be able to search the database and view records.

Hope this helps,
Kim Lewandowski
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
That's not a problem. Do you want those with "author" rights to be able to edit the descriptions?


------------------
JPD





Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
It would be difficult.

I'm still not sure what is going on with these descriptions. (I know I'm dense! Smile ) Is it that you want one description of what a Family Practice is that will apply to all records that have Family Practice in that field?


------------------
JPD





Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Hello, Kim...

Looks like you've jumped right into it! Good for you. Smile

(Sorry...My favorite hang out at Gossamer is DBMAN Discussion Forum...I rarely venture over here.) Smile

A point of clarification regarding the fancy build mod, JPDeni...I told Kim that she could use checkboxes to select multiple departments (since the employees tend to work in various departments) and then use the fancy select mod to build a drop down menu that can be used in the search or navigation form.

Kim,

Here is what we have implemented for our Employee Directory:

In the default.cfg file:

Code:
# Checkbox fields. Field name => Checkbox value.
%db_checkbox_fields = (
Area => 'Accounting,Administration of Justice,Allied Health Sciences',
Department => 'Accounting and Budget,Admissions and Records,Continuing Education'
);

Note: Area signifies Academic Area. Department signifies Department or Office.
Some of our "staff" also teach and are consequently associated with Acadmic Area(s).
Some of them teach multiple classes in various academic areas. Also, to maintain "default" values, you will need to insert the following codes into your html_record sub-routine in the html.pl file:

(Insert them at the top of the sub-routine.)

Code:
foreach $column (@db_cols) {
$rec{$column} =~ s/_/ /g;
}

AFTER

Code:
my (%rec) = @_;

Then in html.pl:

Code:
sub build_fancy_select_field {
# --------------------------------------------------------
#
# To call this subroutine from html_record_form, use the following syntax:
#
# print &build_fancy_select_field("FieldName",$rec{'FieldName'});
#
# Be sure to express the field name *exactly* as it is defined in your .cfg file.
#

my $field = $_[0];
my $compare = $_[1];
my %selector = (
'Area' => [
['---','Choose one of the following:'],
['Accounting','Accounting (ACC)'],
['Armed Forces ROTC','Armed Forces ROTC (AES)'],
['Agriculture','Agriculture (AGR)'],
['Allied Health Sciences','Allied Health Sciences (AHS)'],
['Administration of Justice','Administration of Justice (AJS)'],
['Anthropology','Anthropology (ANT)'],
['Art','Art (ART)'],
['American Sign Language','American Sign Language (ASL)'],
['Automotive','Automotive (AUT)'],
['Aviation','Aviation (AVT)'],
['Biology','Biology (BIO)'],
['Business','Business (BUS)'],
['Chemistry','Chemistry (CHM)'],
['Computer Information Systems','Computer Information Systems (CIS)'],
['Criminal Justice','Criminal Justice (CJC)'],
['Cooperative Education','Cooperative Education (COE)'],
['Counseling','Counseling (COU)'],
['Construction Technology','Construction Technology (CRP)'],
['Dance','Dance (DAN)'],
['Drafting','Drafting (DFT)'],
['Economics','Economics (ECN)'],
['Education','Education (EDU)'],
['Engineering','Engineering (EGR)'],
['Elective-Transfer Credit Only','Elective-Transfer Credit Only (ELE)'],
['Electronics','Electronics (ELT)'],
['Emergency Medical Services','Emergency Medical Services (EMS)'],
['English','English (ENG)'],
['Environmental Studies','Environmental Studies (ENV)'],
['French','French (FRE)'],
['Fire Science','Fire Science (FSC)'],
['Geography','Geography (GEO)'],
['German','German (GER)'],
['Geology','Geology (GLG)'],
['Human Development Education','Human Development Education (HDE)'],
['Home Economics','Home Economics (HEC)'],
['History','History (HIS)'],
['Hotel Restaurant Management','Hotel Restaurant Management (HRM)'],
['Humanities','Humanities (HUM)'],
['Industrial Tech Construction','Industrial Tech Construction (ITC)'],
['Journalism','Journalism (JRN)'],
['Leadership','Leadership (LDR)'],
['Math','Math (MAT)'],
['Manufacturing Industrial Tech','Manufacturing Industrial Tech (MIT)'],
['Music Performance (MUP)','Music Performance (MUP)'],
['Music (MUS)','Music (MUS)'],
['Navajo (NAV)','Navajo (NAV)'],
['Nutrition (NTR)','Nutrition (NTR)'],
['Nursing (NUR)','Nursing (NUR)'],
['Office Information Systems','Office Information Systems (OIS)'],
['Physical Education','Physical Education (PHE)'],
['Philosophy','Philosophy (PHI)'],
['Physics','Physics (PHY)'],
['Political Science','Political Science (POS)'],
['Psychology','Psychology (PSY)'],
['Recreation','Recreation (REC)'],
['Religious Studies','Religious Studies (REL)'],
['Real Estate','Real Estate (RES)'],
['Science','Science (SCI)'],
['Sign Language','Sign Language (SLG)'],
['Sociology','Sociology (SOC)'],
['Spanish','Spanish (SPA)'],
['Speech','Speech (SPC)'],
['Threatre','Theatre (THR)'],
['Welding','Welding (WLD)'],
],
'Department' => [
['---','Choose one of the following:'],
['Account and Budget','Accounting and Budget'],
['Admissions and Records','Admissions and Records'],
['Continuing Education','Continuing Education'],
['CCC-NAU Office','CCC-NAU Office'],
['College Store','College Store'],
['Curriculum','Curriculum'],
['Disability Resources Center','Disability Resources Center'],
['Facilities Management','Facilities Management'],
['Faculty Support','Faculty Support'],
['Financial Aid','Financial Aid'],
['Human Resources','Human Resources'],
['Information Resources Center','Information Resources Center'],
['Information Technology','Information Technology'],
['Institutional Research and Assessment','Institutional Research and Assessment'],
['Learning Enhancement Center','Learning Enhancement Center'],
['Office of the President','Office of the President'],
['Office of the VP for Administrative Support','Office of the VP for Administrative Support'],
['Office of the VP for Educational Services','Office of the VP for Educational Services'],
['Page Dean Office','Page Dean Office'],
['Public Information and Relations','Public Information and Relations'],
['Purchasing and Special Projects','Purchasing and Special Projects'],
['Receptionist','Receptionist'],
['SelfPRIDE','SelfPRIDE'],
['Student Employment Services','Student Employment Services'],
['Small Business Development Center','Small Business Development Center'],
['Tech Prep','Tech Prep'],
['Vocational Counseling','Vocational Counseling'],
],
'Location' => [
['---','Choose one of the following:'],
['Flagstaff Campus','Flagstaff Campus'],
['Grand Canyon','Grand Canyon'],
['Page Campus','Page Campus'],
['Williams','Williams'],
],
);
$output = qq|<SELECT NAME="$field">\n|;
$i = 0;
while ( $selector{$field}[$i][0] ) {
$selector{$field}[$i][0] eq $compare ?
($output .= qq|<OPTION VALUE="$selector{$field}[$i][0]" SELECTED>$selector{$field}[$i][1]\n|) :
($output .= qq|<OPTION VALUE="$selector{$field}[$i][0]">$selector{$field}[$i][1]\n|);
++$i;
}
if ($i) { $output .= "</SELECT>"; }
else { $output = "Incorrect field definition"; }
return $output;

}

You will notice that I have created a fancy drop-down menu that is used for the "Search/Navigation" Form. But the checkboxes are used in the admin forms.

Since I am currently "installing" a Classified Ads program using DBMAN, I may be over in this Forum more often. I'll try to respond when I can.

I hope this helps. Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

(I had to edit this to make the page more readable. -- JPD)

[This message has been edited by JPDeni (edited August 09, 1999).]
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Okay. I have a list of 12 medical depts. Some of the depts have one or more practice office locations or subspecialties, some don't; each dept and practice/subspecialty will have a description associated with it. For example, Family and Community Medicine has two practice locations and three subspecialties.

When site visitors choose Patient Services (a link from the home page), one of the options will be a dropdown list of the medical depts. After selecting a dept, the page they land on will list either

1) the dept description and list of doctors in that dept (if it has no subdivisions) and the doctors' names will be linked to a search on their name, so that if the visitor clicks on a doctor's name they get a page listing that doctor's demographic data from the database.

or

2) the dept name, dept description, and a list of locations/subspecialties, like this:

Department of Family and Community Medicine

Behavioral Medicine
Geriatrics
Ghent Family Practice
Portsmouth Family Medicine
Weight and Well Being

where those five items are linked to a page that will display the location/subspecialty description and the list of doctors associated with that location/subspecialty. And the list of doctors will be linked to the doctor page, as in #1 above. I don't think I need to repeat the dept description here.

I hope this makes sense Smile

Thanks for posting that code, Eliot. I'm going to print it out for study.

Also, I'm checking on whether the practice managers should be allowed to update the descriptions; I'm thinking yes, but I want to be sure.

Kim Lewandowski
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Eliot, it is better if you can try to make the coded part of your posts fit as much as possible within one page. I can't read the last post that kim wrote without a whole lot of work on my poor aging eyes.

Kim, if you want to have each record have a different description, you'll need to have fields in your database for the descriptions.

If you want every instance of "Family Practice" to have the same description, which is editable only by you, you can set up some variables in your .cfg file.

Code:
$prac_desc{'Family Practice'} = "This is where one doctor takes care of the whole family";
$prac_desc{'Geriatrics'} = "This is a practice that focuses on problems of the aged."

You would do the same for $dept_desc.

You would not need your

dept_desc => [2, 'alpha', '50x4', 150, 1, '', '' ],
practice_desc => [4, 'alpha', '50x4', 150, 1, '', '' ],

fields.

When you create your html_record, you would use

<tr><td>Practice:</td><td>$rec{'practice'}</td></tr>
<tr><td>Practice description</td><td>$prac_desc{$rec{'practice'}}</td></tr>

Does this make any sense?


------------------
JPD





Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Sorry, JPDeni...I'll refrain from posting codes in the future.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Eliot, I didn't tell you to refrain from posting codes. I asked you to try to make sure they didn't scroll all the way across the page.

I find that about three lines in the posting textarea will fit on a regular page. Sometimes code requires a little more than that and that's okay. But just take a look at your code after you post it and try to keep it within reasonable boundaries on the page.

I apologize if I offended you.


------------------
JPD





Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Well, with the combination of adding in too many codes and with syntax errors, it is best that I take a more silent position.

I am not offended...Don't worry. Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Can we start over? Smile

I'm confused now. And you probably are, too. With the time between the posts, I had
forgotten about the multiple checkbox thing.

Is there any way you can use a select field for the practice and dept fields?
It would work a whole lot better than using checkboxes.


------------------
JPD





Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
I can use a select field for the depts, but some physicians are associated with more than one practice office or subspecialty, which is why I used checkboxes for the practices.

Can you take a moment to look at http://www.evms.edu/services/phyrefdr.html ? It might be easier for you to see what I mean than for me to describe it. I want to convert this JavaScript monstrosity to a database that 12 managers can maintain, for the most part.

Let me know if you need more info. Thanks.

KimL
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
I can use a select field for the depts, but some physicians are associated with more than
one practice office or subspecialty, which is why I used checkboxes for the practices.

Can you take a moment to look at http://www.evms.edu/services/phyrefdr.html ?
It might be easier for you to see what I mean than for me to describe it. I want to convert
this JavaScript monstrosity to a database that 12 managers can maintain, for the most
part.

Let me know if you need more info. Thanks.

KimL
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
I have my answer - the practice managers
should be allowed update the descriptions of
the practice they are responsible for.

Each physician record will be associated with
a dept and one or more practices, and the
description for the dept and practice(s) will
be displayed whenever the physician record is
displayed.

Where do I put those variables? Is there some
info somewhere on how variables work? I have
not found anything by searching the forum.
Thanks,

Kim Lewandowski
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
You can put the variables in your .cfg file. Understand that, in order to edit the descriptions
the practice managers will have to have access to the scripts.


------------------
JPD





Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
Okay, I decided not to let them edit the descriptions Smile

Before I go any further, I want to make sure I understand what I need to do.

I don't need to have a field for each dept and practice/specialty in the checkbox field
(practice1=behavioral, practice2=geriatrics, etc.),
I can just have two checkbox fields: dept and practice, and list all the depts and
practices in those two fields.

Then I can make my own variables, like so:

Code:
# User-defined variables: Practice/specialty descriptions
# Format is $prac_desc{'practice name'} = "description";

# Family and Community Medicine
$prac_desc{'Behavioral Medicine'} = "description";
$prac_desc{'Geriatrics'} = "description";
$prac_desc{'Ghent Family Practice'} = "description";
$prac_desc{'Portsmouth Family Medicine'} = "description";
$prac_desc{'Weight and Well Being'} = "description";

# Internal Medicine
$prac_desc{'General Internal Medicine/Primary Care - Hofheimer Hall'} = "description";
$prac_desc{'General Internal Medicine/Primary Care - DePaul Hospital'} = "description";
$prac_desc{'Cardiology'} = "description";

BTW, is there any problem with inserting comments between variables like that?

Thanks,
Kim Lewandowski
Quote Reply
Re: Setting up checkbox fields, associating with select fields In reply to
I'm sure Eliot won't mind that I shortened a couple of lines. It's sure easier for me to read! Smile

Department is in a select list and there will be only one department per record. Practices are in checkboxes and there can be multiple practices per record. Right?

Okay.

Your department descriptions would be:

Code:
$dept_desc{'Department Name'} = "description";

When you print out the description, you would use

Code:
<tr><td>Department Description</td>
<td>$dept_desc{$rec{'dept'}}</td></tr>

That's the easy one. Smile

The practice descriptions will be a little tougher. The label needs to be the same as the field name. So, if you're calling your practice checkbox fields practice#, the labels on the descriptions will have to match:

Code:
$prac_desc{'practice#'} = "description";

You can put comment lines between them.

When you go to print out the practice descriptions, you would use:

Code:
|; # to close off any previous print qq| statement
foreach $practice (%prac_desc) {
if ($rec{$practice}}) {
print qq|<tr><td>$rec{$practice}</td>
<td>$prac_desc{$practice}</td></tr>|;
}
}

Does this make any sense?


------------------
JPD





> >