RE: [Zope] Select Box Problem
The entire form is in a <dtml-in> that has a customerid value. I would like to have the current customer show up in this box. How would I tell the select box to select the current custoemer as default?
I had a similar issue on a form I created. There are basically two ways to make this work. One is server-side the other using JavaScript. I chose the former for mine. I simply just inserted the chosen selection as the first item in the list then followed it with the query data. Assuming when the form is rendered there is a REQUEST variable customerid as your example it would look something like this: <select name=customerId> <dtml-in sql_getCustomerName> <option value=<dtml-var customerId>><dtml-var firstName> <dtml-var lastName> </dtml-in> <dtml-in "sql_getCustomers(omit=customerId)"> <option value=<dtml-var customerId>><dtml-var firstName> <dtml-var lastName> </dtml-in> </select> This should do it. The first query (sql_getCustomerName) will return one record of the customer info by customerId. This returns the current customer's name for the list. The second query (sql_getCustomers) returns every customer except the one specified by omit. The omit argument could be made optional to return all in other instances. Hope that helps, Casey Duncan
participants (1)
-
caseman@mad.scientist.com