Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6096039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:52:49+00:00 2026-05-23T12:52:49+00:00

I have a system that allows a person to select a form type that

  • 0

I have a system that allows a person to select a form type that they want to fill out from a drop down box. From this, the rest of the fields for that particular form are shown, the user fills them out, and submits the entry.

Form Table:

| form_id | age_enabled | profession_enabled | salary_enabled | name_enabled |

This describes the metadata of a form so the system will know how to draw it. So each _enabled column is a boolean true if the form should include a field to be filled out for this column.

Entry Table:

| entry_id | form_id | age | profession | salary | name | country |

This stores a submitted form. Where age, profession, etc stores the actual value filled out in the form (or null if it didn’t exist in the form)

Users can add new forms to the system on the fly.

Now the main question: I would like to add the ability for a user designing a new form to be able to include a list of possible values for an attribute (e.g. profession is a drop down list of say 20 professions instead of just a text box when filling out the form). I can’t simply store a global list of possible values for each column because each form will have a different list of values to pick from.

The only solution I can come up with is to include another set of columns in Form table like profession_values and then store the values in a character delimited format. I am concerned that a column may one day have a large number of possible values and this column will get out of control.

Note that new columns can be added later to Form if necessary (and thus Entry in turn), but 90% of forms have the same base set of columns, so I think this design is better than an EAV design. Thoughts?

I have never seen a relational design for such a system (as a whole) and I can’t seem to figure out a decent way to do this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:52:50+00:00Added an answer on May 23, 2026 at 12:52 pm

    Create a new table to contain groups of values:

    CREATE TABLE values (
        id SERIAL,
        group INT NOT NULL,
        value TEXT NOT NULL,
        label TEXT NOT NULL,
        PRIMARY KEY (id),
        UNIQUE (group, value)
    );
    

    For example:

    INSERT INTO values (group, value, label) VALUES (1, 'NY', 'New York');
    INSERT INTO values (group, value, label) VALUES (1, 'CA', 'California');
    INSERT INTO values (group, value, label) VALUES (1, 'FL', 'Florida');
    

    So, group 1 contains three possible values for your drop-down selector. Then, your form table can reference what group a particular column uses.

    Note also that you should add fields to a form via rows, not columns. I.e., your app shouldn’t be adjusting the schema when you add new forms, it should only create new rows. So, make each field its own row:

    CREATE TABLE form (
        id SERIAL,
        name TEXT NOT NULL,
        PRIMARY KEY (id)
    );
    
    CREATE TABLE form_fields (
        id SERIAL,
        form_id INT NOT NULL REFERENCES form(id),
        field_label TEXT NOT NULL,
        field_type INT NOT NULL,
        field_select INT REFERENCES values(id),
        PRIMARY KEY (id)
    );
    
    INSERT INTO form (name) VALUES ('new form');
    $id = last_insert_id()
    INSERT INTO form_fields (form_id, field_label, field_type) VALUES ($id, 'age', 'text');
    INSERT INTO form_fields (form_id, field_label, field_type) VALUES ($id, 'profession', 'text');
    INSERT INTO form_fields (form_id, field_label, field_type) VALUES ($id, 'salary', 'text');
    INSERT INTO form_fields (form_id, field_label, field_type, field_select) VALUES ($id, 'state', 'select', 1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a system that allows guest logins via a guest account. I cannot
I have a system (let's call it System A) that allows the user to
Does anyone have a suggestion on how to create a system that allows me
I have the following: a system that allows me to publish statuses to my
I have a CMS system that allows people to also use HTML code, but
I have a system that combines the best and worst of Java and PHP.
I have a system that uses a meta refresh to a logout page, which
I have a system that creates an order and that order can be billed
We have a system that has a Mysql database with about 2Gigs of data.
Here's an interesting question. I have a system that attempts to run some initialization

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.