I'm not explicitly storing the country or state because the city has a
reference to a state which has a reference to the country.
I don't think I'm breaking MVC much more than it is already routinely
broken in web2py whenever you use SQLFORM, as the states and countries on
the dropdown have the
aaah you are creating your view in the model, have you not heard of MVC and
separation of concerns?
That would work, but it is violating the MVC principle.
Also, it looks like you are only storing the 'city' and not the country or
state. What happens if in two countries they have the same city
You are in luck, I had to do this for one of my projects. Here's a widget I
made for a project where I had the same problem but I had 3 levels,
Country->state->city
For countries that don't have states you can use administrative regions,
but it's also trivial to adapt this to only 2 levels.
*M
It is not working because you need the list of options when the form is
generated, not when it is submitted, in fact this line is executed when the
form is generated:
db.auth_user.city.requires =
IS_IN_SET(COUNTRIESANDCITIES[request.post_vars.country])
yet at this time the form is not submi
4 matches
Mail list logo