How to allow special chars?

Hello

Is there a way to allow/deny chars in an input field?
I would like to allow just numbers from 0-9.

Thank you

Hello
Here is your approach:

myForm = new dhtmlXForm("myForm"); myForm.loadStruct("../___xml/form.xml", function(){ inp = myForm.getInput("inptest"); inp.onkeypress = function(e) { e = e||event; if ((e.charCode < 48 || e.charCode >57) && e.charCode != 0){ return false } } });

Works fine for me … but … in the first position you can fill in any char. After the first position function fires. I have a mistake but where? Here’s my code:

         Form.attachEvent("onInputChange", function(name, value, form){
			   switch (name) {
			      case "field3_5": 
					 input = Form.getInput(name);					 
					 input.onkeypress = function(e) {						 
						 e = e || event;
						 if ((e.charCode < 48 || e.charCode > 57) && e.charCode != 0){ return false; } 
					 } 
					 break; 
			   }
			});

Best regards
Oli

hi

try onkeydown and also there is a way: value = value.replace(chars_to_remove,"")

I found a solution with “Live Validation / ValidNumeric”.
Optical i can see if a cell/field is valid or not. But is there any function to check that?

Thank you.

myForm.validate() return true/false + there is event onValidateError which will give you ID
check our docs docs.dhtmlx.com/doku.php?id=dhtmlxform:toc