Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • JohnAss 18 posts 128 karma points
    Oct 15, 2020 @ 19:47
    JohnAss
    0

    Creating a property editor - how to validate before Save

    I have the following js:

    angular.module("umbraco").controller("NullableIntController", function ($scope) {
    
    $scope.regex = /^[-+]?[0-9]+$/;
    
    });
    

    And the html:

    <div ng-controller="NullableIntController">
    <input type="text" ng-model="model.value" ng-pattern="regex" />
    </div>
    

    The first time I tried to save a content-node with this I wasn't allowed.

    However, now it just lets me save even though I type in letters. The value ends up being null if it's not matching the regex - but I can still hit the Save button.

    Im so confused as to how it worked once and now it's just not anymore.

    How can I make sure it wont allow me to save when the pattern is incorrect?

    Already looked at this post: https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/85517-custom-property-editor-input-type-number-doesnt-show-value

    But it didn't really help

  • Mark Roffey 31 posts 184 karma points
    Jan 05, 2021 @ 20:32
    Mark Roffey
    0

    Did you ever figure out how to do this?

    I'm looking to validate a form fields on submit.

Please Sign in or register to post replies

Write your reply to:

Draft