I have created a custom view in Calls that is based on the editview but I want to change the save button to post back to a custom action in my custom controller. I think I basically need to overide the editview defs with my own defs. I have tried adding calllistviewdefs.php but this doesn’t seem to work.
What is the correct way to override edit view buttons in this case?
Here is the code so far:
Controller
require_once('include/MVC/Controller/SugarController.php');
class CallsController extends SugarController {
function action_CallList() {
$this->view = "calllist";
}
}
view
require_once('include/MVC/View/SugarView.php');
class CallsViewcallList extends ViewEdit {
public function CallsViewcallList() {
parent::SugarView();
}
public function preDisplay()
{
parent::preDisplay();
$metadataFile = 'custom/modules/Calls/metadata/calllistviewdefs.php';
}
public function display() {
parent::display();
}
}
There are a few ways, but I would suggest outputting javascript after parent::display() and hijack the existing Save buttons (top and bottom). Reset the onclick for those buttons to whatever you would like.