struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "aum strut" <aum.str...@gmail.com>
Subject Validating Autocompleter using javascript
Date Tue, 09 Dec 2008 18:37:00 GMT
Hi all,

i am struck in a simple problem but not able to proceed as i m unable to
find any solution for this. I am using struts2 UI tags and in order to
validate the user input i am using javascript for validation(Currently not
in a position to use validation frame work).

everything was going ok but now i have to use auocompleter and here
javascript validation is not working.i have created a seperated javascript
file and validating the user input using this file.

My javascript validation is working fine(even displaying errors) up to the
point it encounters autocompleter but it stops validating the input fields
after it.

below is the code i m using to validtate autocompleter:


<s:autocompleter name="addressPO.city" forceValidOption="true" theme="simple"
id="addressPO.city" cssClass="inputText" cssStyle="width:125px" list="{'Andaman
and Nicobar','Andhra Pradesh','Arunachal Pradesh','Assam'}"/>



and the code to validate this is:

document.getElementById('addressPO.city').value = document.getElementById(
'addressPO.city').value.trim();

if(document.getElementById('addressPO.city').value == null ||
document.getElementById('addressPO.city').value == "" )

{

alert("error");

}

following is the error Mozilla is showing to me

*Error: document.getElementById("addressPO.city") has no properties*

*
*Any suggestion for this are welcomed

Pleaes suggest me where i am doing wrong in order to validate this
autocomplete.

thanks in advance,

umesh

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message