Create, edit, delete

I have been trying to master the coldbox structure of development and I’ve made progress. I’ve created forms to get data into the database but what I can’t figure out is how to edit it? An example is I created a form for a user to enter additional information about themselves that was not collected at registration. How do I first check to see if they have previously entered information and if they have, populate the form with the data so they can edit or add additional? How do I delete data? I think I’m not entirely understanding how the properties in the model work with the handler and the userService. I’ve killed two 12 hour days trying to find references to help me but no luck. I even tried orm and vu.js. I’m not the brightest bulb in the pack but I know I can grasp this.

Before coldbox I could query to see if they have a record and if they do present an edit button and of not then an add link. I’m just not sure how to do this in coldbox

Check out these files from one of our workshops:

Posts handler: up-and-running-with-quick/posts.cfc at step-6 · Ortus-Solutions/up-and-running-with-quick · GitHub

Routes config file: up-and-running-with-quick/Router.cfc at step-6 · Ortus-Solutions/up-and-running-with-quick · GitHub

The resources( “posts” ); creates seven routes for doing CRUD operations as detailed here: Resourceful Routes - ColdBox HMVC Documentation

So one option is to query for this additional data in your edit route to populate if it exists.

You can see an option about sharing view logic here:

Finally, if videos are more your learning style, we have some great options on CFCasts:

Please note that Quick or ORM are not required to use ColdBox. Neither are these the only patterns you can use to solve your situation. But hopefully they help.

Thank you so much!!! I have gone through the zero to hero a couple of times and it has been very helpful. It’s from that video I learned the structure for entering registration as well as additional information, however, it didn’t show how to edit the information like for the rant or something. I will go through the links you sent, thank you so much!!!

Your help has been great, I know can create, edit, show and delete. I am having one error I can’t resolve. When I post a comment I get an error “The event: PostComments.create is not a valid registered event.”

This is my route: post( “/posts/:postId/comments”, “PostComments.create” );

Please disregard, I had a typo in my handler!

I am having one error I can’t resolve.

I’m new to ColdBox (10 months or so). This resonated with me. It is pretty straightforward to make great progress with ColdBox but I regularly hi one error I can’t solve. I’m light years ahead of where I was even two months ago. As I’ve learned enough to ask more intelligent questions, the gang at Ortus has really been helpful.