plz help me...............how to create two drop-down lists code in pylons

0 views
Skip to first unread message

sreepathy reddy

unread,
Jul 6, 2009, 11:25:35 AM7/6/09
to pylons-...@googlegroups.com
hi all......

plz help me...

how to create two dropdowns in pylons

1. first create a table inserting some values and the table values assing the first drop-dwon list
   
2. u select the 1st drop-down list value, automaticaly chenge second drop-down list values.

for example:- 
                      suppose first drop-down list is country, second drop-down list is state
                        
                            i) the first drop-down list values taken from countries table, and second drop-down list
values taken from states table from database.

                          ii) after u select the one country suppose USA in first drop-down list, than second drop-down list automaticaally
show the USA states
                        
                          iii)  u select the one country suppose UK in first drop-down list, than second drop-down list automaticaally
show the UK states only



plz help me................and  tq

Thankq

sreepathyreddy.m
sreepat...@gmail.com
09989456431

Mike Orr

unread,
Jul 6, 2009, 5:09:51 PM7/6/09
to pylons-...@googlegroups.com

You'll have to use Javascript to change a dropdown list based on
another dropdown list. Consult a Javascript reference for this.
You'll have to create an action in your application to return a list
of states. For instance, if the Javascript notices that the country
has been set to US, it might request /ajax/states/US, and the action
might return a JSON list of (state_id, state_name) pairs, which the
Javascript would put into the droptown.

However, Pylons' @jasonify raises a warning when converting a list,
citing this possible attack:
http://wiki.pylonshq.com/display/pylonsfaq/Warnings

I'm not sure what's best in this case. You could ignore the warning,
or return a text file containing one state per line (with the first
word in the line being the ID).

(Attention Ben: the URL in the warning is out of date.)

--
Mike Orr <slugg...@gmail.com>

Paweł Stradomski

unread,
Jul 6, 2009, 7:39:56 PM7/6/09
to pylons-...@googlegroups.com
W liście Mike Orr z dnia poniedziałek 06 lipca 2009:

> However, Pylons' @jasonify raises a warning when converting a list,
> citing this possible attack:
> http://wiki.pylonshq.com/display/pylonsfaq/Warnings
>
> I'm not sure what's best in this case. You could ignore the warning,
> or return a text file containing one state per line (with the first
> word in the line being the ID).
The attack is only possible if the list (array in JavaScript) is top-level
object. So it is just enough to wrap the list in some object,
eg: {'states': [...]}

--
Paweł Stradomski

Reply all
Reply to author
Forward
0 new messages