I'm a self taught novice coder and my friend who I'm doing some work for would like me to add a section to his website that will allow his Admin users to create a form that users can fill out. At first the idea sounded pretty easy, just find out if the user wants to create an input field, radio button, then record the number of options, and store everything in a database. Allow them to enter descriptive text, and move on to the next input type. Perhaps add some sort of way to order these new items for the particular form that is being worked on.

The end result will allow admin users to crate various forms to gather contact information, etc. Of course there ends up being more to it such as javascript form checking if the admin user wants to ensure a certain field to only accept numeric values, etc. upon submitting form.

I'm trying to figure out the logic behind what I'm about to do so that I can make this happen.

Does anyone know if there's anything open source out there that has already has this functionality?

Thanks! 🙂

    cadkins23 wrote:

    Does anyone know if there's anything open source out there that has already has this functionality?

    Google might.

      An interesting idea and I can imagine how it would work.

      Here's how I imagine it:

      1. A table that holds the form names. You will need to make sure each form name is unique, so if the form is called "Survey" and a form with that name already exists, you'll need to not allow it and require that it's renamed. Structure might be something like this:

      tbl_Forms
      FormID - identity - I would use this for the table names, something like this tbl_Form1, etc. as the tables names will need to be unique.
      FormTitle - for the heading
      FormMessage - The message you show on the page once the form is submitted.

      1. A table that holds the specific fields for each form, perhaps with a structure, something like this:

      tbl_FormFields
      FieldID - identity
      fFormID - foreign key to the Forms table
      Label - for the form element
      FieldName - Used for the form elements name, identity and the table field name - more on that later.
      FieldType - text, radio, checkbox etc.
      Text - Is it a text field
      Text - Length - if it's a text field, what's the maximum length
      Required - is it a mandatory field
      Numeric - must it be numeric
      Date - date validation requited

      1. Once you've added all the required fields to the form, you will need to create a table to store the results in using the form field details to create each field in the table with the right properties, numeric, varcher(Length), datetime etc.

      2. To list all the forms use the FormID field from tbl_Forms

      3. To view the contents of a table you'll then need to generate the SELECT statements and display the contents using "FieldName" from tbl_FormFields
        to label the columns/fields etc.

      All do-able, but quite a bit of work to do from scratch. 😃

        Xerxes is right - that's pretty much how I built one.
        Note that it can rapidly become more complex with dropdown selects, the numerous possible checks on user input, javascript checking on inputs and editable entries (needed on user detail and preferences forms) .

          Are you looking to create multiple forms to gather contact information ?

            Write a Reply...