risto
03/31/2022, 9:16 PMAdam Cameron
<form>
on a web page. That's not how these things are done.
Have a route listening for a POST, and in the POST handler work out what the operation is and call another method according to whether the submitted button value was "Edit" or "Delete".
(pretty much guess work as you didn't give us any code to make a more informed analysis)Adam Cameron
// MyController.cfc
component {
public function actionSlug() {
if (params.buttonName == "Edit") {
return handleEdit(params)
}
if (params.buttonName == "Delete") {
return handleDelete(params)
}
// however one handles a 400 response in CFWheels
}
private function handleEdit(params) {
// etc
}
private function handleDelete(params) {
// etc
}
}
(NB: there's probably some sorta CFWheels-idiotmatic way of doing that; it's just pseudo-code)Adam Cameron
params.buttonName
before any of that... all that jazz goes without saying)Peter Amiri
03/31/2022, 9:47 PMristo
03/31/2022, 9:58 PMristo
03/31/2022, 10:00 PMristo
03/31/2022, 10:03 PMristo
03/31/2022, 10:10 PM#linkTo(text="Delete",data_method="delete",key=contact.id,class="btn btn-sm btn-alt-danger btn-circle float-right",encode="attributes",data_confirm="Are you sure you wish to delete #contact.firstname# #contact.lastname#?")#
Adam Cameron
Adam Cameron
Adam Cameron
risto
03/31/2022, 10:46 PMAdam Cameron
risto
03/31/2022, 10:54 PMristo
03/31/2022, 10:56 PMPeter Amiri
03/31/2022, 11:12 PM<button hx-delete="/deleteRoute"
hx-swap="innerHTML"
hx-target="#another-div">
Delete
</button>
<div id=“another-div”></div>Peter Amiri
03/31/2022, 11:16 PMPeter Amiri
03/31/2022, 11:17 PMristo
04/01/2022, 12:02 AMPeter Amiri
04/01/2022, 12:18 AM