Villlas, yes that variant with .xml() add attribute, but that variant with 
FORM not worked, and I don't know how to add it in FORM.
def my_func():

    form = FORM(DIV(DIV(LABEL('Год:', _for='year'),
                    SELECT(*years, _name='year', _id='year',
                           requires=IS_INT_IN_RANGE(request.now.year - 1, 
request.now.year + 1,
                                                    error_message='Указан 
некорректный год!'),
                           _class='form-control', **{'_v-model': 'year'}),
                    _class='col-sm-12 col-md-4 col-lg-3'), _class='form-group 
row'))
    return dict(form=form)

P.S. That variant not worked:
XML(SELECT(*years, _name='year', _id='year', _class='form-control',   
requires=IS_INT_IN_RANGE(request.now.year - 1, request.now.year + 1, 
error_message="Year isn't correct!"), **{'_v-model': 'year'}).xml())


среда, 23 сентября 2020 г., 18:41:12 UTC+3 пользователь villas написал:
>
> Strange,  copy and paste lines in the shell...
>
> >>> years = ['2020','2021']
>
> >>> SELECT(*years, _name='year', _id='year', _class='form-control',   
> requires=IS_INT_IN_RANGE(request.now.year - 1, request.now.year + 1, 
> error_message="Year isn't correct!"), **{'_v-model': 'year'}).xml()
>
> '<select class="form-control" id="year" name="year" v-model="year"><option 
> value="2020">2020</option><option value="2021">2021</option></select>'
>
>
>
> On Wednesday, 23 September 2020 at 12:18:50 UTC+1 Константин Комков wrote:
>
>> I do form with fields *year, month* and another some fields which must 
>> be loaded from table in database if year and month != ''.
>> I know how to make that with vue attributes, but cun't create them inside 
>> function in controller. Villas, your example is the same - not work. If I 
>> add **{'_data-test': 'test'} - when form was generated I have 
>> data-test="test" in select, **{'_v-model': 'year'} -when form was generated 
>> I don't have v-model="year" in select.
>>
>> вторник, 22 сентября 2020 г., 20:50:15 UTC+3 пользователь Константин 
>> Комков написал:
>>
>>>
>>> I don't know but it's not working:
>>>
>>> SELECT(*years, _name='year', _id='year',
>>>        requires=IS_INT_IN_RANGE(request.now.year - 1, request.now.year + 1,
>>>                                 error_message="Year isn't correct!'"),
>>>        _class='form-control', **{'_v-model': 'year'})
>>>
>>>
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/dd3b2019-9d3a-4270-bef9-209189cfcad3o%40googlegroups.com.

Reply via email to