Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I'm creating a prevalue editor where the user can create a array of settings.
If there is no entry in the array saving should not be possible.
What I'm trying to do is this
$scope.$on("formSubmitting", function (ev, args) { if ($scope.myarray.length == 0) { return false; } });
But I don't know how to cancel the submit and show a error message ? Anybody got an idea ?
Or should I create a class implementing IPropertyValidator? But that seems overkill for such a simple check
Dave
For those interested. I have found a solution for my problem, but it feels a bit hacky. But for now it does the trick.
I have created a hidden in put filled that I marked as required :
<input type="hidden" name="Count" ng-model="Count" required />
Then in my controller I change the value of this field when changing my array. If the array is empty, I clear the value of the hidden field. Now validation works for me.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Prevent prevalue editor from saving
Hi,
I'm creating a prevalue editor where the user can create a array of settings.
If there is no entry in the array saving should not be possible.
What I'm trying to do is this
But I don't know how to cancel the submit and show a error message ? Anybody got an idea ?
Or should I create a class implementing IPropertyValidator? But that seems overkill for such a simple check
Dave
Hi,
For those interested. I have found a solution for my problem, but it feels a bit hacky. But for now it does the trick.
I have created a hidden in put filled that I marked as required :
Then in my controller I change the value of this field when changing my array. If the array is empty, I clear the value of the hidden field. Now validation works for me.
Dave
is working on a reply...