I'm creating 2 forms for the front-end that a registered user can fill out. I'm looking at using formit2db and/or formit2resource to accomplish this. I have 2 hurdles I need to get over...
First is a product page where a user can create product listings and upload images for those products and are saved to a product table. (the uploading and referencing those images is the first hurdle)
Secondly on the second form I need for them to be able to select certain products from the (product) table they would like to feature and display on their profile page with a link to buy that product.
Additionally, when they submit either form it has to go into an unpublished state until it is approved. another issue I'm having is with the db2formit and db2resource for ediitng this info. haven't grasped how this is done.
Is there a way to accomplish this using formit or what would be the best solution. I need for this all to be done from the front-end.
Am a bit of a noob to Modx, with some php and database knowledge
Any insight/help would be really appreciated.
Richard
-
☆ A M B ☆
- 24,524 Posts
Formit works with what are called "hooks". Most are post-hooks - basically just snippets that get run after the form is posted. Email and redirect are common examples of post-hooks; email is what sends the email for a contact form, and redirect is what redirects the user to another page upon successful submission.
http://rtfm.modx.com/extras/revo/formit/formit.hooks
Pre-hooks are again basically just snippets, but they are run the first time the page is requested, when there is as yet no POST submitted. A common pre-hook is to pre-populate some of the form fields with values from the database.
http://rtfm.modx.com/extras/revo/formit/formit.hooks#FormIt.Hooks-UsingpreHooks
You can use your own custom pre- and post- hooks to do anything you want. Here is where your PHP and db knowledge will come into play. Write your snippet code to do what you want, then indicate in your formIt snippet properties what snippets you want to run for that form.
http://rtfm.modx.com/extras/revo/formit/formit.hooks#FormIt.Hooks-CustomHooks
Thanks sottwell for the help... I'll have to learn a bit more on php at this point to be able to write the snippets. At this point no clue but I'll read up on the hooks.