by second level update i mean: selecting a country should update the cities
*and* the telephones. currently only cities.
Am 30.08.2012 17:36 schrieb "Richard Vézina" <[email protected]>:

> What you mean a second-level update?
>
> I had hack a bit lazy option in order to make it trigger a js event, so
> once the first condition is selected, the field with the widget binded to
> it is filtered and become available then when the second field is selected
> I trigger a js event, but from the lazy option widget.
>
> I can show my hacked lazy option class.
>
> Richard
>
> On Thu, Aug 30, 2012 at 11:29 AM, Daniel Gonzalez <[email protected]>wrote:
>
>> Hi,
>>
>> I have implemented an example of this here:
>> https://github.com/gonvaled/web2py-tests
>>
>> First-level update is working. I have no idea yet how to implement
>> second-level update.
>> Ideas / comments are greatly appreciated.
>>
>> Thanks,
>> Daniel
>>
>> On Thursday, August 30, 2012 8:03:05 AM UTC+2, Daniel Gonzalez wrote:
>>>
>>> I am trying to adapt the lazy_options_widget to my requirements, but I
>>> am not sure I will succeed. What I am trying to do is:
>>>
>>>    - two elements, one is the primary selector, and the other is the
>>>    secondary selector
>>>    - selecting the primary triggers an ajax call to web2py
>>>    - the ajax call will return an html (typically a select) which will
>>>    be used to update the secondary selector
>>>    - the html is generated by a user-defined function, and takes as
>>>    input parameter the value selected in the primary selector
>>>    - nothing is database bound. The user can generate the data as he
>>>    pleases (maybe from database, maybe not)
>>>    - jQuery is used to perform the ajax accesses and to update the html
>>>    - all the data can be processed by a standard web2py FORM
>>>
>>> Basically this is similar to the implementation in the lazy_options_widget,
>>> but in my case my data is not in the database.
>>>
>>> Ideally the same schema should be useful for multi-selectors. For
>>> example: country, region, city:
>>>
>>>    - Selecting a country updates regions and cities
>>>    - Selecting a region updates cities
>>>
>>> I am not sure a generic approach is feasible, at least not with my
>>> limited knowledge of web2py.
>>>
>>> On Thursday, August 30, 2012 7:14:41 AM UTC+2, lyn2py wrote:
>>>>
>>>> +1
>>>>
>>>> Yes! Pls consider built in functionality. I will be happy to help test
>>>> this.
>>>>
>>>> If I am good with the code I would write it, but I am not. I will be
>>>> happy to work with Anthony or any web2py expert to come up with this
>>>> functionality.
>>>>
>>>> Thank you.
>>>>
>>>> On Wednesday, August 29, 2012 10:09:43 PM UTC+8, Anthony wrote:
>>>>>
>>>>> This is a very frequent request -- we should probably have some built
>>>>> in functionality to handle this. In the meantime, check out
>>>>> http://stackoverflow.com/**questions/8146260/best-**
>>>>> practice-for-populating-**dropdown-based-on-other-**
>>>>> dropdown-selection-in-web2p/**8152910#8152910<http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910>
>>>>>  for
>>>>> some ideas.
>>>>>
>>>>> Anthony
>>>>>
>>>>> On Wednesday, August 29, 2012 9:59:37 AM UTC-4, Daniel Gonzalez wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have a very common situation. The user has to choose a country and
>>>>>> a city. For both fields, I am using a select component.
>>>>>> The possible choices in the city component depend on what the user
>>>>>> has selected in the country component.
>>>>>> So what I would like to do is:
>>>>>>
>>>>>>    1. The user selects the country
>>>>>>    2. The cities component gets updated with data from the server
>>>>>>    (web2py), *without* reloading the whole form.
>>>>>>    3. The user selects the city
>>>>>>    4. The form is submitted.
>>>>>>
>>>>>> I have no idea how to implement step 2. Could somebody comment?
>>>>>>
>>>>>> Thanks
>>>>>> Daniel
>>>>>>
>>>>>  --
>>
>>
>>
>>
>
>  --
>
>
>
>

-- 



Reply via email to