Letractively / cfwheels

Automatically exported from code.google.com/p/cfwheels
0 stars 0 forks source link

FormFor Function #69

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Add a formFor function that when called checks the properties on the
object, loops through them and calls the appropriate form helper
(textField, textArea etc). Basically a real quick way of outputting an
entire form when you don't need to customize it.

Original issue reported on code.google.com by per.djurner@gmail.com on 24 Jul 2008 at 4:29

GoogleCodeExporter commented 9 years ago
I have the code for this already as well, It would need to plug some of your 
adapter code in it, and it would be 
the same. But I think this should be part of a "generators" section and not 
just a method to output a quick form

Anyway here is my code, I can try to adapt it more to wheels if you want

Original comment by rierar...@gmail.com on 23 Oct 2008 at 2:12

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by per.djurner@gmail.com on 6 Mar 2009 at 11:14

GoogleCodeExporter commented 9 years ago

Original comment by per.djurner@gmail.com on 7 Mar 2009 at 9:26

GoogleCodeExporter commented 9 years ago
I was thinking about this the other day.  I wanted to create a cfcomponent 
called
FormBuilder.cfc . As a start I just copied all the functions from 
view/forms.cfm into
the component, removed all the arguments "objectName" and added a method init() 
which
takes the model object.

Now I can create a form with code like this:
#startFormFor( model=post, result="f" )#
#f.textField( "title" )#
#f.textArea( "body" )#
#submitTag( "Save Changes" )#
#endFormFor()#

The "f" variable is a FormBuilder object.  I also stored the FormBuilder in the
request scope so as to cope with nested calls adn to check that endFormFor 
always
matches startFormFor.

You could even write:
#startFormFor( model=post, result="f" )#
#submitTag( "Save Changes" )#
#endFormFor()#

and then the FormBuilder could use the meta information in the "post" object to 
cycle
thru the columns and create the appropriate form fields.  This would be done by
endFormFor() if he could see that no form fields had been created.

I am just at the beginning but if I get somewhere, and I can work out plugins 
work,
then I'll try to submit something.

William

Original comment by william....@gmail.com on 16 Sep 2009 at 9:17

GoogleCodeExporter commented 9 years ago
Great idea, William. Sounds like a great plugin that could eventually be merged 
into
the code base.

Original comment by chriscle...@gmail.com on 16 Sep 2009 at 10:52

GoogleCodeExporter commented 9 years ago

Original comment by per.djurner@gmail.com on 6 Dec 2009 at 6:03

GoogleCodeExporter commented 9 years ago
@william

do you have the code for this? can you post it here?

Original comment by tpetru...@gmail.com on 5 Jun 2010 at 9:23

GoogleCodeExporter commented 9 years ago

Original comment by per.djurner@gmail.com on 12 Jul 2010 at 1:58

GoogleCodeExporter commented 9 years ago
@william,

i know it's been quite a while since your post on this, but would you happen to 
still have the code laying around so i can take a look at it?

Original comment by tpetru...@gmail.com on 13 Jul 2011 at 12:34

GoogleCodeExporter commented 9 years ago

Original comment by tpetru...@gmail.com on 29 Jun 2012 at 3:47