Gossamer Forum
Home : Products : DBMan : Customization :

Options list on search output

Quote Reply
Options list on search output
I have two fields defined as options. Now on the search page which is only viewable by me it shows a drop down list, but the potions are the options I enetered into the script. (i.e. option1,option2 and so on) It does not show the actual options from that field. Now on search output I used the $build_select and it put the drop down list in the output, but once again it showed the same above option1 and so on. I want it to read the file and pull the options I have in the field and display them. Is this possible or did I screw something up somewhere?

I do not use the add_record to add stuff to database. I enter it and upload the database file.

Thanks,

Queticon
Quote Reply
Re: Options list on search output In reply to
I'm unclear on what you want to be in the select field. You are dealing with a single record. And it's not a form, so selecting something from a select field won't give you anything.

I don't know what you're trying to do here.


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





Quote Reply
Re: Options list on search output In reply to
okay I have a field. It is marked as a select field. The data in the field is seperated by commas. For example: red,white,blue

Okay now I want these to be displayed on the page in a drop down box when someone preforms a search. so it would say color red white or blue in a drop down box. Now I can get it to make a drop down box on search output by using $build_select I think that is the code. but the drop down list is filled with option1 option2 option3 and so on. This what I entered in the %db_select_fields variable. I want the actual ciontents of the field to appear in the box and not the option1, option2 option3.

I hope this is a little clearer.

Thanks
Queticon
Quote Reply
Re: Options list on search output In reply to
 
Quote:
Okay now I want these to be displayed on the page in a drop down box when someone preforms a search.

This is on the search form? Or in the search results?

Quote:
Now I can get it to make a drop down box on search output by using $build_select I think

Not unless you're using a form. What is the purpose of your search results? Why would you need a form?

Quote:
I want the actual ciontents of the field to appear in the box

Assuming you are creating a form for your search results, what is the format of the options in the field? Are the options separated by commas or something else?


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





Quote Reply
Re: Options list on search output In reply to
Okay your not understanding me. I am talking of search results. And yes I have used the $build_select in search results and recieved a drop down box.

I dont need a form on search results. I need the contents of the field, that is seperated by commas, to be displayed in the drop down box. another words I have a widget that is for sale. It has three colors red, white and blue. When a search is prefomred. The results of that search I want to make a drop down box for said widget with the options red, white and blue. As it stands right now the only thing showing up in any drop down box weather on a search form or in the results is a drop down box called color with this in it "option1, option2 option3", those actual words appear. I want the words from the field to appear in the drop down box not option1 option2 option3, in both the search forms and the search results.

Queticon
Quote Reply
Re: Options list on search output In reply to
Possibly your select field will show up for users of Internet Explorer when there is no form defined. But users who visit your site using Netscape will just see a list of the options, not in a select box. (I've been through this before. Smile )

Your options are separated by commas. To create a select field from a comma-separated list, use the following. (I'm assuming your field is called "Options." If it's anything else, you'll need to change the code below to match.)

Code:
@selectfields = split (/,/, $rec{'Options'});
print qq|<SELECT NAME="Options">|;
foreach $field (sort @selectfields) {
print "<OPTION>$field");
}
print "</SELECT>";



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





Quote Reply
Re: Options list on search output In reply to
This ties into JPD's message above. her code makes the dropdown list, like-a so:

Code:
<select name="Options">
<option>Red
<option>White
<option>Blue
</select>

The above is the exact HTML code used to make a select dropdown box, with red, white, and blue as options.

To view the contents of this select box in your output, add the following code to your html.pl in sub html_record:

Code:
You selected the color $rec{'Options'}.

You would not actually show a dropdown list with your color in it, you would display the color in text instead. You could even get really creative:

Code:
You selected the color <FONT COLOR=$rec{'Options'}>$rec{'Options'}</FONT>

Smile Hope that helps!

--Lee


[This message has been edited by leisurelee (edited April 04, 2000).]
Quote Reply
Re: Options list on search output In reply to
okay added the code you gave me and this is the error message I got.

CGI ERROR
==========================================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: syntax error at ./products1.pl line 153, near ""$field")"
syntax error at ./products1.pl line 156, near "$field")"
syntax error at ./products1.pl line 170, near "


the file is out there to look at http:www.absolutedesire.com/products1.pl.txt

the code I added is in the sub html record area. It was added to the size and color output. Near the bottom of that section.

Thanks
Queticon

Quote Reply
Re: Options list on search output In reply to
First, you need to keep the lines formatted as they are on the forum. Often when you just cut and paste, the lines all smoosh together on one line. You need to go in and hit your "Enter" (or "Return") key at the end of each line. If nothing else, it makes it a lot easier to read.

You need to start another print statement after the option field:

Code:
@selectfields = split (/,/, $rec{'Options'});
print qq|<SELECT NAME="Color">|;
foreach $field (sort @selectfields) {
print "<OPTION>$field");
}
print "</SELECT>";

print qq|</td>
</tr>
|;

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





Quote Reply
Re: Options list on search output In reply to
never mind there was a single ) after field...removed it and it is working perfectly now.....thank you all

it is up and working....this datbase has 3266 items in it. I will do testing on this before regsitering it. this number should be close to 4000 to 5000 by months end.

thank you
great product so far
Queticon
Quote Reply
Re: Options list on search output In reply to
okay changed like you said and still getting field error

CGI ERROR
==========================================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: syntax error at ./products1.pl line 157, near ""$field")"
syntax error at ./products1.pl line 176, near ""$field")"

www.absolutedesire.com/products1.pl.txt

is the new pl file

Thanks
Queticon