You need to sign in to do that
Don't have an account?
Hiteshkumar Chaudhari 2
how to restrict user to take numberic input in visualforce page??
how to restrict user to take numberic input in visualforce page??
i am using : :" <h1>Amount</h1><apex:input type="number" id="damount" value="{!damount}" /> "
it gives error "Expected input type 'text', got 'number' for String data type"
i am using : :" <h1>Amount</h1><apex:input type="number" id="damount" value="{!damount}" /> "
it gives error "Expected input type 'text', got 'number' for String data type"
and one more is displaying custom error
use this coad
public class checknumericvalue {
public string name{set;get;}
public checknumericvalue(){
}
public void check(){
if(name.isNumeric()==true){
apexpages.addMessage(new ApexPages.message(apexpages.Severity.WARNING,'give only characters only'));
}
}
}
<apex:page controller="checknumericvalue" >
<apex:form>
<apex:messages />
<apex:pageBlock title="check value">
<apex:inputText value="{!name}" />
</apex:pageBlock>
<apex:commandButton value="check" action="{!check}" />
</apex:form>
</apex:page>
but the best way is use java script
I hope this workout for your requierment
All Answers
but using jqueryscript we achive it
can we append it to the viualforce page??
and one more is displaying custom error
use this coad
public class checknumericvalue {
public string name{set;get;}
public checknumericvalue(){
}
public void check(){
if(name.isNumeric()==true){
apexpages.addMessage(new ApexPages.message(apexpages.Severity.WARNING,'give only characters only'));
}
}
}
<apex:page controller="checknumericvalue" >
<apex:form>
<apex:messages />
<apex:pageBlock title="check value">
<apex:inputText value="{!name}" />
</apex:pageBlock>
<apex:commandButton value="check" action="{!check}" />
</apex:form>
</apex:page>
but the best way is use java script
I hope this workout for your requierment