0

I am creating a website wherein Admin is supposed to create a Form and the other users are supposed to fill it and submit it.

My main goal is to the give the Admin user a webpage where he will type the question , select the type of answer to be required and add options if necessary ( for checkbox and radiobuttons ).

I need to create a form based on these details and the form should be updated whenever a question is updated/deleted/modified.

The form will then be shown to the registered user to fill up.

The main problem is where to store the details of the form and how to create it whenever a question is added/deleted/modified

I was thinking of creating a XML file where in users would add fields he would like to display and then the form will be created dynamically on run-time.

But this approach is becoming too cumbersome and i was thinking if there is an easier way to do so.

3
Contributors
8
Replies
22
Views
3 Years
Discussion Span
Last Post by iamthwee
0

This is not as straightforward as it may seem. However, it can be done, but you need to think of how to store the form creation data and filled-form from users. Ideally both would be stored in a DB, but as you've noted, it can become cumbersome.

XML for the form creation data is certainly an idea and may offer an easier implementation than developing a full-blown set of related tables.

One issue with the XML approach is the need to use DOMDocument or SimpleXML or XPath to parse / create / update the XML to/from HTML. Because the fields are dynamic, the php for data handling will need to be quite robust too.

If we look at the types of questions that admins could ask...

1) Single answer from multiple choice - select or radiobuttons (maybe single checkbox if 'either/or')
2) Multiple answers from multiple choice - multiple in list box or checkboxes
3) Simple text - textbox
4) Integer - number or textbox
5) Prose - textarea
6) List of values - textarea

I'm sure that you could think of more, but it may be a place to start

So the info the admin needs to provide for each type of question:

All questions:
The question itself - possibly including image(s) - so you may wish to provide a WYSIWYG control with optional filemanager for uploads

1 & 2) Choose between the 3 types of controls. Provide labels and values for each possible answer. Are there any specifics (attributes and properties), e.g. 'multiple', 'optgroup' or default selections (e.g. checked/selected)

3 & 4) Is this a humble textbox or does it a 'new' type e.g. 'number' with a spinner or a colour widget.

5) This should be straightforward. But "size is important", heh (cols and rows).

6) Do items have to separated by commas or placed on a new line?

On top of this, the admin may wish to place 'placeholder' text in texboxes or textareas

Will multiple choice answers require something other than just (or instead of) text, e.g. images? E.g. shapes in IQ tests.

One approach to storing data from multiple selections (select or checkboxes) can be seen on my demos page - http://demos.diafol.org/bitwise-checkboxes.php

These are just a few rambling thoughts - once you have an idea of what you think you're going to offer the admin in his/her toolbox, then you can start designing the interface, data handling, data storage and importantly the data manipulation and extraction.

0

Currently i am using the XML idea and have created the add question page with a question being inserted in the questions.xml file.

I am having problem creating the edit question page.

I am unable to create WYSIWUG type of page with a list of editable questions

0

Unless you provide code, it's impossible to know what to suggest.

I am having problem creating the edit question page.

What's the problem?

I am unable to create WYSIWUG type of page with a list of editable questions

Why?

I don't think you'll get much help if you don't explain what's going on.

0

What i want to do is to list all questions.

if you click on them you get to edit them.

You should also be able to drag questions up and down to reposition them.

I dont know where to start

0

I dont know where to start

Do you have a list of possible question types (see my suggestions)?
Do you have an idea of form controls available for each type of question?
Do you have a design for admin forms to create and edit (and delete) questions?
Have you thought about storing the question data in an easily retrievable manner, so that the form question can be created dynamically? XML, DB?

If you're completely lost, try an easier project to begin with. This is not a 'beginner level' brief.

0

Do you have a list of possible question types (see my suggestions)?

Yes simple question,question with choice and question having multiple answers

Do you have an idea of form controls available for each type of question?

Yes,textbox,radiobutton and checkbox

Do you have a design for admin forms to create and edit (and delete) questions?

Yes,for add and delete having some problems with edit

Have you thought about storing the question data in an easily retrievable manner, so that the form question can be created dynamically? XML, DB?

Yes, am able to store and retrive data from an XML file using XMLParser

If you're completely lost, try an easier project to begin with. This is not a 'beginner level' brief.

What i was previously planning was just adding/deleting questions but i was asked to have the option to edit the questions

Edited by Nigam_1

0

OK could you show your code so far and we may be able to work with that. Constructing something from scratch, would take a couple of days, and I don't think many contributors here would be up for it. I certainly wouldn't - I typically give 10-15 minutes on a topic that interests me.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.