Xpages Client Side Validation Text field value

I’m hoping someone can tell me what I am doing wrong. I have a text field on my xpage that has a default value. I am trying to create client side validation in case a user removes the value. However every time I clear the field and try the validation my alert box is saying that the default value is still there even though the field is now blank on the screen. I have a button that does the validation here is the code I am using.

ownEmail= ‘#{javascript:document1.getItemValue(“ownEmail”)}’;

alert(ownEmail);

if(ownEmail == ‘’){

alert(‘Please enter the Owner Name’);

return false;

}

Thanks

Subject: Solved

I added an onchange to the field, which worked great with the prior code in my submit button.

<xp:eventHandler event=“onchange” submit=“true” refreshMode=“complete”></xp:eventHandler>