Skip to content

Commit

Permalink
V8: Add validation to the Version and UmbracoVersion properties (#5559)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mivaweb authored and nul800sebastiaan committed Jun 27, 2019
1 parent 7b99e55 commit 8c5f253
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

vm.buttonLabel = "";

vm.versionRegex = /^(\d+\.)(\d+\.)(\*|\d+)$/;

const packageId = $routeParams.id;
const create = $routeParams.create;

Expand Down
4 changes: 2 additions & 2 deletions src/Umbraco.Web.UI.Client/src/views/packages/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</umb-control-group>

<umb-control-group label="Version" required="true">
<input class="umb-property-editor" name="version" type="text" ng-model="vm.package.version" val-server-field="model.Version" required />
<input class="umb-property-editor" name="version" type="text" ng-model="vm.package.version" val-server-field="model.Version" required ng-pattern="vm.versionRegex" />

<span ng-messages="editPackageForm.version.$error" show-validation-on-submit >
<span class="help-inline" ng-message="required"><localize key="general_required">Required</localize></span>
Expand All @@ -54,7 +54,7 @@
</umb-control-group>-->

<umb-control-group label="Umbraco version">
<input class="umb-property-editor" name="umbracoVersion" type="text" ng-model="vm.package.umbracoVersion" val-server-field="model.umbracoVersion" />
<input class="umb-property-editor" name="umbracoVersion" type="text" ng-model="vm.package.umbracoVersion" val-server-field="model.umbracoVersion" ng-pattern="vm.versionRegex" />

<span ng-messages="editPackageForm.umbracoVersion.$error" show-validation-on-submit >
<span class="help-inline" ng-message="valServerField">{{editPackageForm.umbracoVersion.errorMsg}}</span>
Expand Down

0 comments on commit 8c5f253

Please sign in to comment.