Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Post deleted by SamX

Quote Reply
Post deleted by SamX
Quote Reply
Re: Check Box Confusion In reply to
>> Regarding check boxes, I'm a little confused as to handle these.
>> I want several choices and to be able to choose more than 1:

Ok, this starts to violate the rules of database normalization....

>> Do these need to be separate columns in the database or can this
>> be done via one column say as Platform_Choice ??

This would violate the rules of data normalization.

If you only need one sort of test like this, with 3 or 4 options,
it would make more sense from a performance and ease of use issue,
to use one field for each choice, just make it a short int 0/1 or
an Enum 'No','Yes'

You can create a parse routine such that you store your values in
a single CHAR field, as "1 3 5" or "1|3|5" (for the selected options).

It's probably overkill to create an "answers" table, such that you
have a mapping such as:

PK->(ID), FK->(?), QUESTION->(Number), Answer->(number)

Where PK is a primary key, unique identifier, automatically managed.
FK is a foreign key that links this record to the user or link, or whatever
Question is the question number and Answer is the answer value.

Each record can have the same FK, Question, and a different answer
without a problem. Technically, you don't need the PK field, but it
makes life a lot easier with Links and tables in general.

You'd do a :

Select * from Answers_Table
Where FK = "what_questionaire_you_are_looking_at"
Group by Question
Order by Question,Answer


(I don't use group/order much, but it's probably close).

Overkill?? <G> :)

PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Quote Reply
Re: Check Box Confusion In reply to
The subject says it all ;)

I believe Sam means to be able to pass a value from individual question box's rather than from the same box (I think!)

If so, you can use check boxes on a custom form like:
CHECKBOX: Name: Platform_Linux Value: Yes

With the results at:
The Answer is: <%if Platform_Linux%><%Platform_Linux%><%else%>No<%endif%>

This works because a check box is either a value, or not a value.

This will require seperate columns in the database for each "qustion" using a CHAR Column Type just make sure the Not Null option is set to No

Eraser:
Insight Eye
http://www.insighteye.com/
Quote Reply
Re: Check Box Confusion In reply to
There were a couple of parts to this question.

1) I want a user to be able to select more than one option.
2) can I store that in one field, or do I need one field for each option.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Quote Reply
Post deleted by SamX In reply to
Quote Reply
Re: Check Box Confusion In reply to
You could also use Radios to give yourself a Yes or No answer and save using the <%else%> tags. See what works best for your setup.

Good luck!

Eraser:
Insight Eye
http://www.insighteye.com/