Hi Dave! Thanks for responding. There is no NULL value in the country table and in the source code, United States is 'selected' but its not selected on the page. I am not getting why its happening. Please guide me if you know the reason.
>Have you looked at your 'view source' code to see if 'selected' is every >being generated? > >Are there any records in your table that have an empty cty_iso2 column? > >Dave ><tr> > <td>Country</td> > <td> > <select name="addr_country"> > <cfoutput query="getCountries"> > <option value="#getCountries.cty_iso2#" <cfif variables.addr_country eq >getCountries.cty_iso2>selected<cfelseif not >len(trim(variables.addr_country)) and getCountries.cty_iso2 eq >'US'>selected</cfif>>#getCountries.cty_name#</option> </cfoutput> > > </select> > </td> ></tr> > >and I am using this query > ><cfquery name="getCountries" datasource="country table"> > SELECT cty_iso2, cty_name > FROM ref_countries > ORDER BY cty_name ></cfquery> >but unfortunately, the correct country is not getting selected. If a country >value is there, I want it to be selected, if nothing is there, I want United >States as default. The column cty_iso2 has two letter code for the country >like 'US' and cty_name contains the whole name like United States of >America. I am not able to pin point what's wrong with this code. Also, I >convert all the form fields values into variables scope before the start of >the page. Please help. Thanks for help in advance. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:310758 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4