Re: [Zope] How to retrieve the selection list
On Tuesday 09 January 2001 16:01, Angietel wrote: The following is my selection list, where should i put the dtml-var custcountry in order to display the selected result. Ooh... this one hurts.. (o8 You have to put "SELECTED" on the 'option' tag you want to be default. This means iterating over your list with something like: dtml-in CountryList option dtml-if "_['sequence-item']==custcountry" SELECTED/dtml-if value="dtml-var sequence-item"dtml-var sequence-item /dtml-in If you don't already have the country list in an object somewhere, I recommend adding a "lines" type property to either that object, or an appropriate folder, and put them in there. And remember... if "custcountry" doesn't exist.. this will break... do putting a: dtml-unless custcountry dtml-call "REQUEST.set('custcountry',' ')" /dtml-unless at the top of the page won't hurt. select name="custcountry" size="1" tabindex="9" style="HEIGHT: 22px; WIDTH: 293px" option value="."selectedPlease select a country/option option value="Australia"Australia/option option value="Cambodia"Cambodia/option option value="Canada"Canada/option 8 *snip* 8 /select Thank You! Have a better one, Curtis Maloney. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How to retrieve the selection list
At 13:01 9-1-01 +0800, Angietel wrote: The following is my selection list, where should i put the dtml-var custcountry in order to display the selected result. You don't have to, as soon as one option is selected you're variable custcountry gets the value from option value="Canada" and the text between option value="Canada" and /option is being displayed. option value="Canada"Canada/option ^ ^ If you have you're countries in a database you can let sql generate an option list in stead of typing all the options. Something like this: select name="custcountry" dtml-in "select_country(REQUEST)" option value='dtml-var country_field'dtml-var country_field/option /dtml-in /select Where select_country is a sql-method like: select country_field from COUNTRY Regards, Diny select name="custcountry" size="1" tabindex="9" style="HEIGHT: 22px; WIDTH: 293px" option value="."selectedPlease select a country/option option value="Australia"Australia/option option value="Cambodia"Cambodia/option option value="Canada"Canada/option option value="China"China/option option value="Colombia"Colombia/option [...] option value="United States"United States/option /select Thank You! DIVA, Faculty of Veterinary Medicine Utrecht University, The Netherlands http://www.vet.uu.nl ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )