Initializing Select Options in Spry
I was using Spry on a form that allowed the user to select a city. For the creation form I just used a standard Spry region, but for the edit form I needed to preselect the city. In order to do this you need to dynamically set a JavaScript variable based on the current value from the database and use that JavaScript variable in the Spry code. The following code shows how it is done:
<script type="text/javascript">
var dsCities = new Spry.Data.XMLDataSet("xmlCities.cfm", "cities/city");
var origCity="#MyQuery.CityID#";
</script>
<div id="cities" spry:region="dsCities">
<select spry:repeatchildren="dsCities" name="cityID" id="citySelect">
<option spry:if="{cityid} == origCity" selected="selected" value="{cityid}">{name}</option>
<option spry:if="{cityid} != origCity" value="{cityid}">{name}</option>
</select>
</div>
var dsCities = new Spry.Data.XMLDataSet("xmlCities.cfm", "cities/city");
var origCity="#MyQuery.CityID#";
</script>
<div id="cities" spry:region="dsCities">
<select spry:repeatchildren="dsCities" name="cityID" id="citySelect">
<option spry:if="{cityid} == origCity" selected="selected" value="{cityid}">{name}</option>
<option spry:if="{cityid} != origCity" value="{cityid}">{name}</option>
</select>
</div>


http://americansentinelblog.com/toymatch/
http://democratie-en-ligne.net/Blog/toymatch/
http://toymatch.artiste-malgache.com/
http://toymatch.blogli.co.il/
http://aziroet.com/toymatch/
http://toymatch.faistonblog.com/
http://toymatch.bigonions.co.uk/
http://marchard-boutin.com/toymatch/
http://toymatch.dreamflicks.com/
http://toymatch.sensualwriter.com/
http://blog.slamxhype.com/toymatch/
http://toymatch.blogsayfasi.com/
http://classadrivers.com/blogs/toymatch/
http://eterblog.com/toymatch/
http://toymatch.pymeblog.info/
http://blog.antimisandry.com/toymatch/
http://toymatch.reviewpublic.com
http://toymatch.e4god.com/blogs/
http://toymatch.reality-blogs.com/reality/
http://del.icio.us/toymatch
http://toymatch.blogcn.com/
http://toymatch.ygblog.com/
http://toymatch.ygblog.com/
http://kyosho.nireblog.com/
http://nireblog.com/en/register/
http://silverlit.nireblog.com/
http://minichamps.nireblog.com/
http://futaba.nireblog.com/
http://tamiya.nireblog.com/
http://www.iseekblog.com/IXO/
http://clearblogs.com/ixo-toys/
http://www.soulcast.com/IXOToys/
http://futaba.weebly.com/
http://ixotoys.blogsboom.com/
http://ixo.beeplog.com/
http://www.hyperblogs.net/ixotoys/