I'm currently developing a custom property editor in Umbraco 7. The problem is when I add buttons to my view and handle the click event in my controller, Umbraco automatically saves the dicument and displays the green bar at the bottom of the screen. For some operations this behaviour is fine, but I have a button that changes the current view of my editor and I don't want it to save when the button is pressed.
Is there a way to diasable the auto save, maybe I can return something (I've tried return false) in the code attached to the button click event...?
The button click seems to be causing the trouble. Nonetheless I have found out a different solution. Instead of a button click I am using a directive. In this sample i wanted to download a document on click event.
View:
<div ng-controller="CreateMSWordController" class="downloadDoc">Download as document</div>
Controller:
angular.module("umbraco")
.controller("CreateMSWordController",
function ($scope) {
});
angular.module('umbraco').directive("downloadDoc", function () {
return {
restrict: "C",
link: function ($scope, $element) {
$element.bind('click', function () {
window.location = "/utility/UtilityPage/?Id=" + $scope.Id + "&type=MSWord";
});
}
}
});
Stop Save executing on button click
Hi Guys,
I'm currently developing a custom property editor in Umbraco 7. The problem is when I add buttons to my view and handle the click event in my controller, Umbraco automatically saves the dicument and displays the green bar at the bottom of the screen. For some operations this behaviour is fine, but I have a button that changes the current view of my editor and I don't want it to save when the button is pressed.
Is there a way to diasable the auto save, maybe I can return something (I've tried return false) in the code attached to the button click event...?
Many thanks,
Damien
Hi Damien,
I am also facing the same issue. Did you come across any solution ?
The button click seems to be causing the trouble. Nonetheless I have found out a different solution. Instead of a button click I am using a directive. In this sample i wanted to download a document on click event.
View:
Controller:
is your problem related to a button element taking on a submit behaviour rather than a click problem?
check your buttons are inserted like this
Thank you! I've been struggling with this, such a simple fix in the end
Oh yes, It worked. Thanks Ian !!
is working on a reply...