Gossamer Forum
Home : Products : DBMan : Customization :

null default option?

Quote Reply
null default option?
hi again carol! didn't think i would be back so soon huh? LOL! anyway....the stuff you helped me with is working great! the problem i have now is that when the search form opens, the first range option in the price field shows up by default. it is the 0-$5000 option, but what i want for a default is a null selection, so that if the visitor doesn't want to use the price field as a search parameter, he doesn't have to. just something like the default choice dbman puts in the basic form....the 3 ---....which would show records of ANY price. like an "all prices" option.

in case you have forgotten, here's the code mod u gave me for db.cgi that allows for the range search...i'm assuming i have to add something in here?

# The line below takes out any commas that you have added to your select list options.
$in{'Price_range'} =~ s/,//g;

# The line below takes out the "+" if the person has selected the highest value
$in{'Price_range'} =~ s/\+//g;

# The line below takes out the dollar signs you have used in the select list options.
$in{'Price_range'} =~ s/\$//g;

# Just making sure the user selected a value in the select field
if ($in{'Price_range'}) {

# Break up the two prices into separate values. (The use of @Prices was intentional.)
@Prices = split /-/, $in{'Price_range'};

# Take the lower price, make sure it's an integer (which will remove any extra spaces)
# and subtract 1 so that the range is inclusive
$in{'Price-gt'} = int($Prices[0]) - 1;

# Check to see if there were two prices entered. Accounts for "100,000+"
if ($Prices[1]) {

# Take the higher price, make sure it's an integer
# and add 1 to it to make the range inclusive
$in{'Price-lt'} = int($Prices[1]) + 1;

# Close off the "if" statements
}
}

thanx again!

chuck
Quote Reply
Re: null default option? In reply to
In the first line of your select field, use

<OPTION>---



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





Quote Reply
Re: null default option? In reply to
oh heck thats all i have to do? i thought i would have to add something to the code to make it reflect the entire range of prices. ok thanx again carol! i hope you get to feeling better soon!