Gossamer Forum
Home : Products : Links 2.0 : Customization :

Creating a YES|NO select box.

Quote Reply
Creating a YES|NO select box.
I am trying to add another YES|NO select box to the end of my Links database.

I have followed the instructions as explained in:
How to Add New Fields to Links 2.0
http://www.gossamer-threads.com/scripts/resources/Detailed/162.html

The problem is that the input field that I create is a text box, and not a select box.

I copied the code in %db_def directly from isNew. I used:
isCanadian => [14,'alpha',0,5,,'No','']

I noticed that further down in links.def there is a section called %db_select_fields I added isCanadian to that, copying the format exactly from isNew, but when I run VIEW in my admin it gives me the following error message:
fatal error: syntax error at /mysite/cgi-bin/admin/links.def line 83, near "isCanadian"

Thanks in advance for your assistance.

Dan Storm

------------------
----------
Get your FREE subscription to:
Making Money with Affiliate Programs

mailto:creativeopportunity-subscribe@topica.com
Quote Reply
Re: Creating a YES|NO select box. In reply to
You have configured the field incorrectly....

You need to have the field configured in the following manner:

Code:
isCanadian => [14,'alpha',0,5,,'No','Yes|No']

Then in the %db_select_fields array, you need to add the following:

Code:
isCanadian => 'Yes,No'

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------




Quote Reply
Re: Creating a YES|NO select box. In reply to
Hello Eliot,

Thanks for your response.

I tried what you suggested, but I still get the same error message.

Am I missing anything else?

Thanks
Dan
Quote Reply
Re: Creating a YES|NO select box. In reply to
Okay...

If the isCandian field is NOT the last db_select_field in the array, then you have to add a comma at the end, like the following:

Code:
isCanadian => 'Yes,No',

Also, make sure that the field before isCanadian field in the %db_def includes a comma at the end BEFORE isCanadian field, like the following:

Code:
BuyaPerlBook => [13,'alpha',0,5,,'No',''],
isCanadian => [14,'alpha',0,5,,'No','']

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------




Quote Reply
Re: Creating a YES|NO select box. In reply to
Eliot...Thank You very much!!

It was exactly what your suggested.

I was missing a comma on the second last entry in %db_select_fields

Many thanks again

Dan
Quote Reply
Re: Creating a YES|NO select box. In reply to
You're welcome.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------




Quote Reply
Re: Creating a YES|NO select box. In reply to
I have only one more question for today Smile

I have added the extra column to each of my database entries. And I have also added the following code to my links.html template:

<%if isCanadian%>
<font color="red">
<b>
<i>
CANADIAN
</i>
</b>
</font>
<%endif%>

The problem is that all the links on my pages contain the CANADIAN tag on them. Even those that indicate NO for isCanadian

Do I have to set-up my if statement elsewhere also?

Thanks again

Dan

------------------
-------
Get your FREE subscription to:
Making Money with Affiliate Programs

mailto:creativeopportunity-subscribe@topica.com
Quote Reply
Re: Creating a YES|NO select box. In reply to
1) Download the Enhanced Template.pm file in the Resource Center and install it!

2) Change the codes you have to the following:

Code:
<%if isCanadian eq 'Yes'%>
<font color="red"><b><i>
CANADIAN
</i></b></font>
<%endif%>

Without using the Enhanced Template.pm file, you will have to add the following codes in your sub site_html_link routine in the site_html_template.pl file:

Code:
($rec{'isCanadian'} eq 'Yes') ? ($rec{'isCanadian'} = 1) : (delete $rec{'isCanadian'});

Then you can use the codes that you have.

I REALLY Hope this helps!

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------






[This message has been edited by Eliot (edited January 09, 2000).]

[This message has been edited by Eliot (edited January 09, 2000).]
Quote Reply
Re: Creating a YES|NO select box. In reply to
I just recently added a state field and after looking at it I do not have the states placed in this area:
State => [22,'alpha',0,75,,'No','']
but it still seems to work.
Should I add the states here also?
State => [14,'alpha',0,5,,'No','California|New York|ect']
Quote Reply
Re: Creating a YES|NO select box. In reply to
Oops...this is actually how it currently reads:
State => [22,'alpha',0,75,,'','']

should I change it to this:
State => [22,'alpha',0,75,,'','California|New York|ect']
Quote Reply
Re: Creating a YES|NO select box. In reply to
The only reason I you put values in the REGULAR EXPRESSION ATTRIBUTE is to ensure that people choose a correct value for that field. It really is NOT necessary for fields with a large number of values (just configure the field in the %db_select_fields array).

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------