Gossamer Forum
Home : Products : DBMan : Customization :

Build Fancy Multiple Select Fields

Quote Reply
Build Fancy Multiple Select Fields
I was able to install the MOD build_fancy_mult_field & everything is working dandy with it. Smile

However, one minor problem I cannot seem to fix is the fact that I do not want the Multiple Select field to show to the Default User when they search.

JPD addressed something similar in the Regular non-fancy multi select mod - by adding a seperate search routine to show a regular drop down list.

Well, I tried that. Of course in order for a separate search routine to work, I had to use the same sub_build_fancy_mult_field title in the routine or it will not find the entries. And, when I use that..of course it goes right back to showing the entire multiple list.

Does anyone have any clue how one might go about doing this? Like I said the MOD works great. I get the fancy names & the multiple select no problem.

I just need the default users to see a normal drop down list & I cannot figure out how to do it. Unsure

The html.pl file of course looks like this:

sub build_fancy_mult_field {
# --------------------------------------------------------
#
# To call this subroutine from html_record_form, use the following syntax:
#
# print &build_fancy_mult_field("FieldName",$rec{'FieldName'});
#
# Be sure to express the field name *exactly* as it is defined in your .cfg file.
#
$size = "5";
my $field = $_[0];
my $compare = $_[1];
my %selector = (
'Class' => [
['---','Choose as many that apply:'],
['All','All'],
['BRD','Bard'],
['BST','Beastlord'],
['CLR','Cleric'],
['DRU','Druid'],
['DRU','Druid'],
['ENC','Enchanter'],
['MAG','Magician'],
['MNK','Monk'],
['NEC','Necromancer'],
['PAL','Paladin'],
['RNG','Ranger'],
['ROG','Rogue'],
['SHD','ShadowKnight'],
['SHM','Shaman'],
['WAR','Warrior'],
['WIZ','Wizard'],
],
'Race' => [
['---','Choose as many that apply:'],
['BAR','Barbarian'],
['DEF','DarkElf'],
['DWF','Dwarf'],
['ERU','Erudite'],
['GNM','Gnome'],
['HEF','Half Elf'],
['HFL','Halfling'],
['HIE','High Elf'],
['HUM','Human'],
['ISK','Iskar'],
['OGR','Ogre'],
['TRL','Troll'],
['VAH','Vah Shir'],
['ELF','Wood Elf'],
],
);

$output = qq|<SELECT NAME="$field" MULTIPLE SIZE="$size">\n|;
$i = 0;
while ( $selector{$field}[$i][0] ) {
$compare =~/$selector{$field}[$i][0]/ ?
($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;
}

& I made the changes to the db.cgi that the mod called for as well.

Thanks for any help.
Diana Rae

Last edited by:

dianarae: Feb 3, 2002, 9:17 PM
Quote Reply
Re: [dianarae] Build Fancy Multiple Select Fields In reply to
Anyone at all have any guidance? If not, I'm going to have to restart this without the fancy. Unsure
Diana Rae
Quote Reply
Re: [dianarae] Build Fancy Multiple Select Fields In reply to
Code:
However, one minor problem I cannot seem to fix is the fact that I do not want the Multiple Select field to show to the Default User when they search

Not quite sure what you mean? Explain a little more, I think it can be fixed, but I want to understand "why" you are wanting to do what you want to do.

It may be something as simple as if ($per_default) {print boring_select} else {print fancy_select}
Quote Reply
Re: [Watts] Build Fancy Multiple Select Fields In reply to
I am using the Build Fancy Multiple Select. I had to make a "fancy multiple select" sub (per the mod).

In the Default search, it doesnt have a "drop down" select box, it shows the mutliple select list as well.

JPD addressed this in her regular multiple select mod by telling us to make a separate search page. But in that MOD it is using the standard select list from the .cfg. That way the separate search page can call the standard build instead of the multiple build.

The "fancy build select" pulls the list from the fancy build select mod, not the .cfg. The default user sees the mutiple select and not a drop down select box. This is what I do not know how to fix.
Diana Rae
Quote Reply
Re: [dianarae] Build Fancy Multiple Select Fields In reply to
*sigh* i have tried everything. If you think this cannot be done, please let me know. Like I said I'll just not use the fancy build.
Diana Rae
Quote Reply
Re: [dianarae] Build Fancy Multiple Select Fields In reply to
Try this (make a back-up first), paste the normal build_select sub back where it used to be, leave the fancy one in place as well.

Do a search in html.pl for &build_fancy_Select and then do something like the following for every place you find it:
Code:
if ($view_search) {&build_select} else {&build_fancy_select};

I'm guessing at the sub names and the syntax, but basically what this should do is give you the fancy select anytime a user is doing anything but searching. When they are searching they'll get the regular select box. You can even get really detailed and do something like:

Code:
if (($view_search) && ($db_uid eq "default")) {&build_select} else {&build_fancy_select};

So that anyone searching with default permissions will get the regular select and anyone searching with non-default permissions gets the fancy one.

I hope I'm understanding what it is you are trying to do.

Once again, I'm guessing at the syntax - I don't have anything in front of me to refer to right now so feel free to post corrections, etc.