Click here to Skip to main content
14,735,093 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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();
       });
}
Posted
Updated 15-Mar-16 9:07am
v4
Comments
Sinisa Hajnal 15-Mar-16 11:26am
   
What have you tried? In the code above, there is no validation methods...
pulimurukan 15-Mar-16 11:47am
   
<td class="tal fntm fntn Editable leftcol" role="gridcell" data-role="editable" style="width: 10%;">

<input type="text" ng-required="requireTel" ng-pattern="phoneNumberPattern" style="width:100%;height:100%" ng-model=data.PhoneNumber class="tal configtext fntn Editable">
</td>


<td ng-if="result.IsEditable=='Y'" class="tal fntm fntn leftcol Editable" style="width: 10%;">
<input type="text" style="height:100%;width:100%" ng-model=result.PhoneNumber
ng-required="requireTel" ng-pattern="phoneNumberPattern"
class="tal configtext fntn Editable">
</td>


these two i tried but its not working and accepting -ve values also

use following in client side validation:

function isNumber(evt) {
if (!evt)
evt = window.event;

var charCode = (evt.which) ? evt.which : evt.keyCode;

if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
   
Comments
pulimurukan 16-Mar-16 4:12am
   
how can we give in html only?my current html is like this.but its not working(given coloumns)

<td class="tal fntm fntn Editable leftcol" role="gridcell" data-role="editable" style="width: 10%;">
<input type="text" ng-required="requireTel" ng-pattern="phoneNumberPattern" style="width:100%;height:100%" ng-model=data.PhoneNumber class="tal configtext fntn Editable">
</td>
<td ng-if="result.IsEditable=='Y'" class="tal fntm fntn leftcol Editable" style="width: 10%;">
<input type="text" style="height:100%;width:100%" ng-model=result.PhoneNumber
ng-required="requireTel" ng-pattern="phoneNumberPattern"
class="tal configtext fntn Editable">
</td>
You could also do this per-emptively: set up an event handler for your control (such as onchange or onkeyup) and have it call a javascript that will update the content with th e return from the following function call:
function Numbers_Only(testString) {
// Uses regular expression to find and replace any non-digit with nothing.  The
// RegEx '\D' is any non-digit (including white-space): same as [^0123456789].
// The 'g' suffix imples do all matches instead of only the first match.
// Steve Miller		      				Bitmask Design, LLC								 2012.02.03
	var len = testString.length;
	if(len > 0)
	  testString = testString.replace(/\D/g , "");
	
return testString;
} // function Numbers_Only(testString)

With this method, only 0 through 9 are allowed as values in the control and it will constantly clean itself of any punctuation, such as a '-' as well as character input.
   
v2
Comments
pulimurukan 16-Mar-16 4:11am
   
how can we give in html only?my current html is like this.but its not working(given coloumns)

<td class="tal fntm fntn Editable leftcol" role="gridcell" data-role="editable" style="width: 10%;">
<input type="text" ng-required="requireTel" ng-pattern="phoneNumberPattern" style="width:100%;height:100%" ng-model=data.PhoneNumber class="tal configtext fntn Editable">
</td>
<td ng-if="result.IsEditable=='Y'" class="tal fntm fntn leftcol Editable" style="width: 10%;">
<input type="text" style="height:100%;width:100%" ng-model=result.PhoneNumber
ng-required="requireTel" ng-pattern="phoneNumberPattern"
class="tal configtext fntn Editable">
</td>
W Balboos, GHB 16-Mar-16 6:50am
   
1) You noted javaScript, which is what I gave you. If you only wanted HTML you should have written that, and then you'd not have much success.
2) You're using Angular (it seems) - which I don't.
3) You spoke of a 'positive integer value' in your title, not a phone number (as in your pasted comment). A phone number can have spaces and hyphens, and the formatting varies by local.

Perhaps you should sit back and consider what it is your really want to do.
pulimurukan 16-Mar-16 7:27am
   
both i want but dat should be in html..2 cloumns one is ph num and other is % column.so % column shuldnot accept -ve values

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900