Adding text fields, areas, buttons online-modifying online

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
newboard
Forum Newbie
Posts: 8
Joined: Fri May 23, 2008 4:35 am

Adding text fields, areas, buttons online-modifying online

Post by newboard »

I want to create an admin page where the admin can modify a form in certain pages without opening up the code, i.e just click a certain box and a text field would appear/removed. is it possible?

example:

NAME: <remove><modify>
AGE : <remove><modify>
<add buttons>

or

you can just drag drop new buttons or fields where preferred.

hope someone can help me :idea:
calcop
Forum Newbie
Posts: 20
Joined: Fri Mar 04, 2005 2:13 pm

Re: Adding text fields, areas, buttons online-modifying online

Post by calcop »

Yes, it is possible.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: Adding text fields, areas, buttons online-modifying online

Post by Kieran Huggins »

That's a rather tall order - but it might need some more thought.

A form represents a data model, one which you have storage for (presumably).

Maybe I don't fully understand what you're actually trying to accomplish?
newboard
Forum Newbie
Posts: 8
Joined: Fri May 23, 2008 4:35 am

Re: Adding text fields, areas, buttons online-modifying online

Post by newboard »

Kieran Huggins wrote:That's a rather tall order - but it might need some more thought.

A form represents a data model, one which you have storage for (presumably).

Maybe I don't fully understand what you're actually trying to accomplish?
what do you understand from it? hopefully i know how to explain more
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: Adding text fields, areas, buttons online-modifying online

Post by Kieran Huggins »

usually when people collect data, like:

Code: Select all

name
age
hair colour
they are going to store it in a database that looks like this:

Code: Select all

name
age
hair_colour
Am I right in thinking you want people to be able to add properties to the form, and then store that? Like adding "eye colour" and have that save in the database?
newboard
Forum Newbie
Posts: 8
Joined: Fri May 23, 2008 4:35 am

Re: Adding text fields, areas, buttons online-modifying online

Post by newboard »

Kieran Huggins wrote:usually when people collect data, like:

Code: Select all

name
age
hair colour
they are going to store it in a database that looks like this:

Code: Select all

name
age
hair_colour
Am I right in thinking you want people to be able to add properties to the form, and then store that? Like adding "eye colour" and have that save in the database?

yup exactly.

now it can becomes(assuming you have this fields):
age <text field>
hair colour <text field>
eye colour <text field>

So this 'people' would be the Administrator. He can click some button in order to get the new field inserted in some place. (the reason is so that any Administrator can admin the page without knowing PHP). The admin can also remove the field by just clicking some button if provided. can it be done?

i.e:

age <text field> (delete)
hair colour <text field> (delete)
eye colour <text field> (delete)


if you notice, that when you create a new/update post, we have the toolbox where we can just 'click' if we want our letters to be bold, underline, etc. it's something like that i want to achieve.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: Adding text fields, areas, buttons online-modifying online

Post by Kieran Huggins »

It could be done, but it's probably more involved then you think it is.

What are you trying to do exactly? Not what are you trying to code, but generally what real-world problem are you trying to solve? There may be a far simpler solution.
newboard
Forum Newbie
Posts: 8
Joined: Fri May 23, 2008 4:35 am

Re: Adding text fields, areas, buttons online-modifying online

Post by newboard »

Kieran Huggins wrote:It could be done, but it's probably more involved then you think it is.
thanks for the encouragement!

What are you trying to do exactly? Not what are you trying to code, but generally what real-world problem are you trying to solve? There may be a far simpler solution.
Ok nice question :D

What i'm trying to do is that i want to make a page for the Administrator where the Admin can change/update/delete the form by just clicking some buttons or dragging/dropping some buttons or icons without even seeing the programming codes. With this we don't have to have a specific Admin who knows certin server language. The admin just need to drag drop or click here and there to update the form. Hope you have some ideas how i can do this. Yeah i know it's a lots of work here but its seems to be fun!
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: Adding text fields, areas, buttons online-modifying online

Post by Kieran Huggins »

might be easier using form inputs:

Code: Select all

field name                     field type (select box)
name: [name               ]    type: [short text              |v]
name: [eye colour         ]    type: [short text              |v]
name: [hair colour        ]    type: [short text              |v]
name: [birthday           ]    type: [short text              |v]
name: [bio                ]    type: [long text               |v]
name: [                   ]    type: [please select...        |v]
name: [                   ]    type: [please select...        |v]
name: [                   ]    type: [please select...        |v]
newboard
Forum Newbie
Posts: 8
Joined: Fri May 23, 2008 4:35 am

Re: Adding text fields, areas, buttons online-modifying online

Post by newboard »

Kieran Huggins wrote:might be easier using form inputs:

Code: Select all

field name                     field type (select box)
name: [name               ]    type: [short text              |v]
name: [eye colour         ]    type: [short text              |v]
name: [hair colour        ]    type: [short text              |v]
name: [birthday           ]    type: [short text              |v]
name: [bio                ]    type: [long text               |v]
name: [                   ]    type: [please select...        |v]
name: [                   ]    type: [please select...        |v]
name: [                   ]    type: [please select...        |v]

owh...how to do it? any tutorials? would like to explore it. thanks!!
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: Adding text fields, areas, buttons online-modifying online

Post by Kieran Huggins »

Something like this:

Code: Select all

<input name="fieldname[]" />
<select name="fieldtype[]">
  <option value="varchar">Short Text</option>
  <option value="text">Long Text</option>
  <option value="int">Number</option>
  <!-- etc. -->
</select>
<!-- wash, rinse, repeat. -->
newboard
Forum Newbie
Posts: 8
Joined: Fri May 23, 2008 4:35 am

Re: Adding text fields, areas, buttons online-modifying online

Post by newboard »

Kieran Huggins wrote:Something like this:

Code: Select all

<input name="fieldname[]" />
<select name="fieldtype[]">
  <option value="varchar">Short Text</option>
  <option value="text">Long Text</option>
  <option value="int">Number</option>
  <!-- etc. -->
</select>
<!-- wash, rinse, repeat. -->
hurm...the think that i'm wondering is that how to update the database (dynamically) also once you add/removed a field in the form field. I'm going to use PHP and MySQL
Post Reply