Html form question

I’m using the same form to edit a record as well as create a new record. I don’t understand how this, #html.startForm( method = args.method, action = args.action )# tells the handler which function to use, edit or create?

This is the html created:
form action=“http://127.0.0.1:41798/Staff/1” method=“POST”
input type=“hidden” name=“_method” value=“PUT” />

At least in two instances it works but I am using it in a third and it’s not working. I can’t figure out how it works well enough to problem solve it.

Thank you so much, One day I will understand this enough that I can start answering questions!!! LOL

Rick

So I figured out where it gets the args.method and args.action:
#renderView( “Staff/_form”, {
“method”: “PUT”,
“action”: event.buildLink( “Staff.#rc.StaffId#” )
} )#
But still don’t understand how it knows if it’s create or edit?

I have no idea what tells it to create the hidden input with the name=_method

I do see that the href for the form has the ID in the url for the edit where the create does not.

Ok, I might have figured it out. One should be POST and the other PUT. Thank you for putting up with me talking through this!

Rick