How to Restrict users to fill number only in number field

Can any body help and give me code how to restrict the users to fill the field only numbers

Subject: How to Restrict users to fill number only in number field

thanks a lot,

Subject: How to Restrict users to fill number only in number field

You didn’t specify the language.

Javascript

if(!isValidNumber(document.forms[0].fieldname.value)){

alert(“Please enter only numeric characters”);

document.forms[0].fieldname.focus();

return false;

}

Formula language

@IsNumber(fieldname) - Put this code in @if

Subject: RE: How to Restrict users to fill number only in number field

Thanks,

I want to write this code in LS and this is not working in Formula Language where i written this code in Input Translation. Need Help

Subject: RE: How to Restrict users to fill number only in number field

LS

use IsNumeric function.

it returns true if the value of a field is numeric.It returns false otherwise. but if the value is empty also, it will return true.

Formula Language

@If(IsNumber(fieldname);@Success;@Failure(“Please enter numeric values”))

Subject: How to Restrict users to fill number only in number field

Hi thanks,

it is working.

But Iam having tabbed tables with controlled sections. so if i didn’t filled this field that is present in other section. it is giving message to fill that field. This could not happen. The person that is givenaccess to that section only need to fill this field not the first requester.

Please give valuable suggestion

Subject: RE: How to Restrict users to fill number only in number field

This would allow the doc to be saved with an empty value in the field, is that OK?

@If(fieldname != “” & @IsNumber(fieldname);@Success;@Failure(“Please enter numeric values”))

Subject: RE: How to Restrict users to fill number only in number field

Thanks,

But this message is prompting even for the first time iam filling the form as this field is present in different section.

srini

Subject: RE: How to Restrict users to fill number only in number field

Try this One, will continue with empty fields

@If(fieldname = “” | @IsNumber(fieldname);@Success;@Failure(“Please enter numeric values”))