You need to sign in to do that
Don't have an account?
santoshk.behera1.3878016627537622E12
can any one give me a example for validation of a input text field in vf page through a button.please help me
scenario:
1) when i will enter any wrong data to the input text field and click the button , it shold show an error message below the field.
2)when i should enter the correct data to the input text field, and click the button, it should call the action method of that button which is writtten in controller.
1) when i will enter any wrong data to the input text field and click the button , it shold show an error message below the field.
2)when i should enter the correct data to the input text field, and click the button, it should call the action method of that button which is writtten in controller.
2,Then check validation in javascript function and if it is true call actionfunction as
function checkValidation(inputVal){
if(inputVal value is correct as per validation)
//call action function
actionFun();
else
show message by rendering text into some div below your text field
}
<apex:actionfunction name="actionFun" action="controllerMethod"/>
Here is the example to make two input text field as required that checks the validation on the click of save button.
<apex:page StandardController="Account">
<apex:form >
<apex:PageBlock >
<apex:PageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel value="AccountName"></apex:outputLabel>
<apex:outputPanel >
<div class="requiredInput">
<div class="requiredBlock"></div>
<apex:inputText label="Account Name :" value="{!account.name}" required="true"></apex:inputText>
<apex:commandButton action="{!save}" value="Save"/>
</div>
</apex:outputPanel>
</apex:pageBlockSectionItem>
</apex:PageBlockSection>
</apex:PageBlock>
</apex:form>
</apex:page>
Hope this example helps.