You need to sign in to do that
Don't have an account?
raghava520
how to Clear text field if validation fails
Hi Experts
i have written a trigger on contact object which ristrict the user to enter only text in language field
trigger contrg on Contact (before insert, before update) {
Contact con = trigger.new[0];
string s1= con.Languages__c;
if(s1.Isalpha()==false){
con.languages__c.Adderror('please enter only text');
}
}
it is working is throwing error when i hit sabe
but the false value which user given is remainig on the text feild so every time user have to delete and must give the correct value is there any way to Clear text field if validation fails
Thanks
Raghava.
i have written a trigger on contact object which ristrict the user to enter only text in language field
trigger contrg on Contact (before insert, before update) {
Contact con = trigger.new[0];
string s1= con.Languages__c;
if(s1.Isalpha()==false){
con.languages__c.Adderror('please enter only text');
}
}
it is working is throwing error when i hit sabe
but the false value which user given is remainig on the text feild so every time user have to delete and must give the correct value is there any way to Clear text field if validation fails
Thanks
Raghava.
if(s1.Isalpha()==false){
s1= NULL;
con.languages__c.Adderror('please enter only text');
}