bolt / boltforms

Bolt 3 Forms extension - Symfony interface and API for Bolt
http://bolt.cm
GNU General Public License v3.0
52 stars 57 forks source link

binding with contenttype/database #28

Closed poznet closed 9 years ago

poznet commented 9 years ago

Hello When i try to bind form with created contenttype it screams about database integrity

It seems that adding to database requires fields like slug,datecreated,datechanged,status

How to add values from form to contenttype(database) without creating those fields in form ?

GwendolenLynch commented 9 years ago

The setting you use depends on the table you want to use.

If you're writing to a ContentType table (called pages):

  database:
    contenttype: pages

If you're writing to a normal table:

  database:
    table: my_table
poznet commented 9 years ago

not quite i created new contenttype , and new table

  database:
    contenttype: rejestracja  # Contenttype to create
    table: bolt_rejestracja    # Specific database table to write to

and even if i don't create these fields (slug etc) in content definition (in contenttype.yml) still seems that they are required ( error with database integrity - required not null etc) when you try to submit form

GwendolenLynch commented 9 years ago

OK, what you might be missing here is the with the database key, you only want 1 option, either contenttype or table. If you specify contenttype it looks up the table for that ContentType, which gets created and populated by Bolt when you tell Bolt to update its database.

If you manually create the table table, your fields must match the form, and you do not need datecreated and friends.

Just thinking about it as I type, have you updated the database since creating the ContentType in app/config/contenttypes.yml?

poznet commented 9 years ago

yep - that was the problem i had both options in database section and of course data was saved twice (with second insert there was error)

To get simple access (via cms) to saved data from form is to create new contenttype and bind form to contenttype

and next lame question (this time is more bolt than forms) : can i turn off(or hide) meta (dates,status etc) for specific contenttype (this connected to forms) in cms ( i simply don't need that info with content that comes from form )

GwendolenLynch commented 9 years ago

Not turn it off as such… However, what I do on my sites is to use tabs in that ContentType, that way the unwanted stuff gets put in the "Meta" tab and kept out of the way.

poznet commented 9 years ago

that solves the problem ( in some way ) thx