Gossamer Forum
Home : Products : DBMan : Customization :

Commas in the Select Field?

Quote Reply
Commas in the Select Field?
How to place commas in the select fields?

I am trying to place names with commas but DBMan is taking it as a separate value.

Like I want to put one value as:
Zeshan, Junior.

But DMan shows it as:
Zeshan
Junior

Below given are the lines from my config file:
====================

%db_select_fields = (
Experts => 'ARNO W. WEISS, JR.,MOHAMMED ARBABI, SR.,WAHEED AKBAR, M.D.',
);

====================

TIA.
Zeshan.
Quote Reply
Re: [zeshan] Commas in the Select Field? In reply to
Try escaping it and see if that works...

put a \ in front of the commas you want to keep:

Experts => 'ARNO W. WEISS\, JR.,MOHAMMED ARBABI\, SR.,WAHEED AKBAR\, M.D.',

Not sure if that will work, but it's worth a try.
Quote Reply
Re: [Watts] Commas in the Select Field? In reply to
I did try this option before posting message.

Its of no use, \ will show as it is in the select field.

Any other options?
Quote Reply
Re: [zeshan] Commas in the Select Field? In reply to
I'm not sure this will work, but according to this document;

http://www.w3.org/...ec/html-spec_13.html

you can get a comma displayed in html with;

,

I sure hope something simple like that works, else I can think of a much more difficult way. You would need to change the delimiter to |, then use the split_decode sub.

But wait, you can build a select field from any flat file, so that sounds easier.
Quote Reply
Re: [joematt] Commas in the Select Field? In reply to
First of all thanks for your response.

%db_select_fields = (
Experts => 'ARNO W. WEISS, JR.,MOHAMMED ARBABI, SR.,WAHEED AKBAR, M.D.',
TRID => '92,93,94,95'
);

Okay, the above trick did work as long as "Add Record" is concerned.

But when modifying the record, the select field is not showing the original value what was selected during the addition.

I know this a comman problem, if you have spaces after commas in select fields. i.e.

field1, field2

I have double checked that there should be no space between two values, but still I am getting the same error.

Need more help.

OR:
Can you please refer me where to find module to build select fields from flat file?

Thanks
Zeshan.
Quote Reply
Re: [zeshan] Commas in the Select Field? In reply to
Here is a text file that should explain the whole thing.

Let me know how it works out.

Glad to help.
Quote Reply
Re: [zeshan] Commas in the Select Field? In reply to
Also check out LoisC's "Unofficial Faq".. check out any of her posts for the URL - there you will probably find a solution.
Quote Reply
Re: [Watts] Commas in the Select Field? In reply to
If you're still interested the answer is in LoisC's Unofficial FAQ under the category "Fields" and is listed on the 3rd page "Is it possible to have commas in the db_select..."

Here is the answer (copied from there):

Is it possible to have a comma (,) in a selection in the %db_select_fields?

You don't have to use commas between the options. You could use a | character. You'd just have to change sub build_select_field to accommodate the change.

Code:
code:
%db_select_fields = ( Boot_Camp => 'MCRD San Diego|MCRD Parris Island|OCS Quantico, VA );

and in sub build_select_field, instead of code:

@fields = split (/\,/, $db_select_fields{$column});

use code:

@fields = split (/\|/, $db_select_fields{$column});

Be sure to log onto this valuable resource - you'll find a lot of really neat ideas and answers there.