Hi,Thanks for your reply.But i had a problem in writing it through code.Because,i can validate those fields only on submit button click.But,i am executing some rules using perform custom acions using rules.Now if i opt to write code all those rules won't execute.Is there any other way i could handle this.