This topic contains 2 replies, has 2 voices, and was last updated by  dmesabar 4 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • jqxinput validation #112105

    dmesabar
    Participant

    Hi,
    I would like if existis one method to validate the value of jqxinput.
    Example:

    $("#input").jqxInput({  value: 100, validate:function(value){
    // some something
    // return true/false; // if false can't end edit and can't change the value
    });

    I can’t use jqxNumberInput to validate if the number is between min and max because the value to enter into input depends of another calculations.
    Only I can now if the number is valid after insert the value.
    Thanks.

    jqxinput validation #112106

    admin
    Keymaster
    jqxinput validation #112117

    dmesabar
    Participant

    Hi Peter,
    I don’t tried the validator and form widget because my input are into the jqxgrid to edit any cell with values.
    I would like have something like this on the editor of jqxgrid

    rule: function (value) { // rule or validate or validation function into jqxinput
    	var d1 = 10; // can be any value. Its varible by row
    	var d2 = 5; // can be any value. Its varible by row
       
    	var disc = 0;
    	if(d1 > 0 && d2 >0){
    		var tmp = (value) * (d1 / 100);
    		disc = tmp + (((value) - tmp) * (d2 / 100));
    	}else if(d1 > 0){
    		disc = value * (d1 / 100);
    	}else if(d2 > 0){
    		disc = value * (d2 / 100);
    	}
    	
    	var unit_price = (value) - (desc_total);
    	if (last_cost > unit_price){ // last_cost is another value of row and its variable
    		return false; // cant edit the value of jqxinput and cant execute cellendedit
    	}else{
    		return true;
    	}
    }

    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.