Gossamer Forum
Home : Products : DBMan : Customization :

dropdown menue

Quote Reply
dropdown menue
I am trying to put a drop down menue in a form. This is what I have in the default.cfg

%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Author => [1, 'alpha', 20, 25, 1, '', ''],
Email => [2, 'alpha', 20, 30, 0, '', ''],


);


Could some one add an example menue in her keeping in mind all punctuation.

Quote Reply
Re: dropdown menue In reply to
Hello Merlo,

First, the form-length (third position to the right) must be set to 0 if you want to use a select field. (The same holds true for: radio field and checkbox field).

IE: For demonstration purposes, lets assume you want both Author and Email fields to be a select field (drop down menu). The code would be as follows. (You'll notice that the third position has been changed to a 0).


%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Author => [1, 'alpha', 0, 25, 1, '', ''],
Email => [2, 'alpha', 0, 30, 0, '', ''],




Next, if you have not already done so, you will need to scroll down further in your .cfg file to:

%db_select_fields = (

And replace the default select_fields to your own.

I have an example here of what it might look like:

NumOffices => '1,2,3,4,5,6,7,8,9,10',
NumDesks => '1,2,3,4,5,6,7,8,9,10',
OfficeLevel => 'Second Level,Main Level',


BTW, I see that in the Email field you have the 'Not-Null' set to zero. Is this what you intended?


I hope this helps Smile

Best Regards,

Kim Lanners



Software Made Easy
http://sme-net.com
Quote Reply
Re: dropdown menue In reply to
Is this the bit I am meant to be changing

# Select fields. Field name => 'comma seperated list of drop down options'.
%db_select_fields = (
Category => 'General,Configuration Management,Project Management,Process Improvement,Standards,Testing & Quality Assurance',
Type => 'Web,Newsgroup,Mailing List,FTP,Gopher'
);


If so would I do this for a drop down menu

%db_Town = (NumOffices => '1,2,3,4,5,6,7,8,9,10',

Quote Reply
Re: dropdown menue In reply to
Hi Merlo,

You wrote:

Is this the bit I am meant to be changing

# Select fields. Field name => 'comma seperated list of drop down options'.
%db_select_fields = (
Category => 'General,Configuration Management,Project Management,Process Improvement,Standards,Testing & Quality Assurance',
Type => 'Web,Newsgroup,Mailing List,FTP,Gopher'
);


Yes


If so would I do this for a drop down menu

%db_Town = (NumOffices => '1,2,3,4,5,6,7,8,9,10',



No, this line in particular would look like this, assuming Town is your field name:

Town => 'Kansas City,Independence,Blue Springs,Shawnee',

(You will create a line for each field that you choose to make select_field.)

So in summary, after modifying the select_field section, it would look like this:


%db_select_fields = (
Town => 'Kansas City,Independence,Blue Springs,Shawnee',
field2 => 'option1,option2,option3,etc.'
field3 => 'option1,option2,option3,etc.'


Does this answer your question?

BTW, are you using JPDeni's DBMan Tutorial? If not, please go to: http://www.jpdeni.com/dbman This tutorial is thorough in explanation. It has helped me immensely.


Best Regards,

Kim Lanners







Software Made Easy
http://sme-net.com
Quote Reply
Re: dropdown menue In reply to
Wow! This is frustrating.

think this is confusing me
%db_select_fields = (


What I want is a drop down menu on my form called ratings and the have from 1-10 on the dropDown

Its where I actully write it, that is confusing me.
I want to keep all my other fields but add one that is a menu

I also need to be able to search the database by someone just choosing all records that match a certain rating number, but I guess that is another story.maybe I will skip that part.
Thanks for your patience

Quote Reply
Re: dropdown menue In reply to
merlo:

I agree with Kim ... I think your best bet would be to go through JPDeni's tutorial and she also has a configurator which will help in setting up your fields.

You might also want to visit the FAQ noted below which would provide your with ideas on possibilities for your database.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: dropdown menue In reply to
Hi Merlo,

Yes, when we don't readily understand something, it can be quite frustrating. Let me try to help you understand.


%db_select_fields = ( You do not need to change this or otherwise manipulate it. Just change the code underneath of it.

Your code in the select_field section would appear as:

%db_select_fields = (
Ratings => '1,2,3,4,5,6,7,8,9,10',
);

Example:

Here is the default code:

# Select fields. Field name => 'comma seperated list of drop down options'.
%db_select_fields = (
Category => 'General,Configuration Management,Project Management,Process Improvement,Standards,Testing & Quality Assurance',
Type => 'Web,Newsgroup,Mailing List,FTP,Gopher'
);



Leaving %db_select_fields in place, remove all other code below between the ( and );

Then insert your Rating line.

%db_select_fields = (
Ratings => '1,2,3,4,5,6,7,8,9,10',


%db_select-fields can thought of as this:

All drop down menu fields and options are: = (
Ratings => '1,2,3,4,5,6,7,8,9,10',
);




Best Regards,

Kim Lanners

Software Made Easy
http://sme-net.com
Quote Reply
Re: dropdown menue In reply to
You must also remove the final comma at the end of the last field. There must not be a comma there after the final ]



David Olley
Anglo & Foreign International Limited,
Winchester
England