Thanks Merrill,
Yes the password checks is working fine with validwhen. But I am having problem with displaying message in window alert. Here is my code, 1st 3 requied field displays fine in pop-up window, but when it comes to validwhen, it dosn't. Again if both passwords are same it works fine. If anybody can help me, that will be great.
<form name="changePasswordForm">
<field property="oldpassword" depends="required">
<arg0 key="label.oldpassword"/>
</field>
<field property="newpassword" depends="required">
<arg0 key="label.newpassword"/>
</field>
<field property="newpasswordAgain" depends="required,validwhen">
<arg0 key="label.newpasswordAgain" />
<msg name="validwhen" key="Both new password should be same."/>
<var>
<var-name>
test</var-name>
<var-value>((newpassword == newpasswordAgain) or (*this* == newpassword))</var-value>
</var>
</field>
</form>
Thanks again....