[Zope] Its nope with zope , parameter prob remains
Cliff Ford
Cliff.Ford at ed.ac.uk
Fri Mar 11 17:21:38 EST 2005
I suggest a different approach to this problem. Instead of priming the
option lists in a page template try the following:
1. put only <option value="selectdistrict" selected> in the select lists.
2. put the data in Javascript arrays:
districts = new Array("district1", "district2")
districts["district1"].users=new Array("UserName1", "Username2"),
districts["district2"].users=new Array("UserName3", "Username4")
3. Use onLoad to prime the districts options (use a function to add
options in districts array) and onClick to change the Username options.
Some people might suggest that sending a list of usernames is a bad
idea. Leaving that bit out would save you a lot of work and avoid the
accessibility issue with onClick.
Cliff
P.S. I sent this earlier today to the original sender and forgot to cc
to zope. The original bounced with this message:
TO:<buddha_2001 at rediffmail.com>:
host mail2.rediffmail.com [203.199.83.4]: 553 sorry, your envelope
sender is in my badmailfrom list (#5.7.1)
Wonder what I have done to get into a badmailfrom list!
prabuddha ray wrote:
> Ya u got me this time abzlutli but i'm jus not getting it.
> looks like there is something else.
> the define code dint work.i'm still getting the same error.
>
> Error Type
> KeyError
> Error Value
> 'districtname'
>
> I'm attaching the ZPT doc n the ZSQL method getDistrictUser is given below.
>
> argument : distname
> sql :select distinct(username) from c_userdet c,c_district d
> where d.district_name=<dtml-sqlvar distname type="string">
> and c.district_code=d.district_code
> order by username
>
> Since it giving error for districtname. duz dat mean its not finding it
> in the pyhton stmt :
> <div tal:repeat="user
> python:context.getDistrictUser(distname=request.form['districtname'])">
>
> Hope i'nt getting over u.
>
>
>
>
> On Fri, 11 Mar 2005 Hong Yuan wrote :
>
>> So you are determining the option value of a 2nd dropdown list from
>> the input of the 1st. Then it is obvious that when the page is frist
>> loaded, the form variable 'districtname' is not set yet, because it is
>> set in the form, right?
>>
>> When this page is first loaded, you maybe want to provide a default
>> value for 'districtname'. I guess this is what you meant.
>>
>> In that case, you may want to test the existence of
>> request/form/districtname, and if the variable is not there, use a
>> default value for it. One way to do so is:
>>
>> <div tal:define="distname request/form/districtname | python:'some
>> value'"
>> tal:repeat="user
>> python:context.getDistrictUser(districtname=distname)">
>> ...
>>
>> this way you make sure 'distname' has some meaningful value before it
>> is used as a parameter of the ZSQL method.
>>
>>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
More information about the Zope
mailing list