如何验证仅接受正整数值? [英] How to give a validation for only accepting positive integer value?

查看:73
本文介绍了如何验证仅接受正整数值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢





当我更新数据时,

我怎样才能验证这一点+ ve值?



我的js部分给予



我尝试了什么:



< input type =textng-required =requireTelng-pattern =phoneNumberPatternstyle =width:100%; height: 100%ng-model = data.PhoneNumber class =tal configtext fntn Editable>

< input type =textstyle =height:100%; width:100%ng -model = result.PhoneNumber

ng-required =requireTelng-pattern =phoneNumberPattern

class =tal configtext fntn Editab le>

以上可编辑的n不可编辑的费用



ive coloumn like


when i updating the data,
how can i validate this with +ve values?

my js part given

What I have tried:

<input type="text" ng-required="requireTel" ng-pattern="phoneNumberPattern" style="width:100%;height:100%" ng-model=data.PhoneNumber class="tal configtext fntn Editable">
<input type="text" style="height:100%;width:100%" ng-model=result.PhoneNumber
ng-required="requireTel" ng-pattern="phoneNumberPattern"
class="tal configtext fntn Editable">
above for both editable n non editable feild

function UpdateValueRange(Integral, Decimal, Minimum, Maximum) {
    var ScreenValue= $scope.data.ScreenValueUpdate;
    var ScreenId= $scope.data.ScreenIdUpdate;
    var FieldCode = $scope.data.FieldCodeUpdate;
    var FiledDescription = $scope.data.FieldDescriptionUpdate;
    var startTime = new Date();
    $('#processingResults').modal('show');

    var promise = configurationDataService.updateValueRange({ ScreenId: ScreenId, ScreenValue: ScreenValue, FieldCode: FieldCode,FieldDescription: FiledDescription, Integral: Integral, Decimal: Decimal, Minimum: Minimum, Maximum: Maximum, UpdatedBy: commonDataOptionsStorageService.getItem("Session_User") });
    promise.then(
       function (payload) {
           commonUtilsService.setFormPrestine($scope);
           CancelEdit();
           onchangesource();
           commonUtilsService.showSucess('Success', 'Value Range Configuration Updated Successfully');
           $('#processingResults').modal('hide');
           var endTime = new Date();
           $scope.timeElapsed = endTime.getTime() - startTime.getTime();
       },
       function (errorPayload) {
           //TODO: error handling
           commonUtilsService.showServerError('Error Updating Data Value Range Configuration.', errorPayload.data);
           $('#processingResults').modal('hide');
           var endTime = new Date();
           $scope.timeElapsed = endTime.getTime() - startTime.getTime();
       });
}

推荐答案

scope.data.ScreenValueUpdate;
var ScreenId =
scope.data.ScreenValueUpdate; var ScreenId=


scope.data.ScreenIdUpdate;
var FieldCode =
scope.data.ScreenIdUpdate; var FieldCode =


scope.data.FieldCodeUpdate;
var FiledDescription =
scope.data.FieldCodeUpdate; var FiledDescription =


这篇关于如何验证仅接受正整数值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆