Good evening, folks, I've come here to unveil a mystery, I'm developing an 
application with web2py, (framework that I use about 3 years ago)

I am using sqlform.factory, passing 2 tables, being that I do this to fill 
in a single form, table, person and address, for better understanding 
follows my controller, 


@auth.requires_login()
def students():
    form = form=SQLFORM.factory(db.person, db.address)
 
    if form.process().accepted:
       id = db.person.insert(**db.person._filter_fields(form.vars))
       form.vars.person=id
       id = db.address.insert(**db.address._filter_fields(form.vars))
       response.flash='Form Submetido com sucesso!' 
 
    elif form.errors:
       print(form.errors)
    else:
       print('please fill out the form')




if it helps, this is my model, the tables and their relationships, 

db.define_table("person",
    Field("name", "string", length=50),
    Field("cpf", "string", length=11),
    Field("birthday", "date", length=11),
    Field("email","string", length=40),
    Field("registration_date","date", length=40)
    )

db.define_table("cities",
    Field("name", "string"),
    Field("state","reference state")
    )

db.define_table("address_type",
    Field("type","string",length=100),
    )

db.define_table("address",
    Field("number","integer"),
    Field("public_place","string"),
    Field("cep","string",length=15),
    Field("complement","string"),
    Field("cities",'reference cities'),
    Field("address_type",'reference address_type'),
    Field("person",'reference person', writable=False,readable=False)
    )




This is my view 

<form action="#" class="form-material" enctype="multipart/form-data" 
method="post">
        <div class="form-group">
            <div class="col-md-12 m-b-20">
                <!--form.custom.widget.name -->
                <input class="form-control" id="no_table_name" name="name" 
type="text" placeholder="nome">
            </div>
            <div class="col-md-12 m-b-20">
                <!--form.custom.widget.cpf -->
                <input class="form-control" id="no_table_cpf" name="cpf" 
type="text" placeholder="cpf">
            </div>
            
            <div class="col-md-12 m-b-20">
                <!--form.custom.widget.email -->
                <input class="form-control" id="no_table_email" name="email" 
type="text" placeholder="email">
            </div>                                                              
          
            <div class="col-md-12 m-b-20">
                <!--    <select class="form-control generic-widget" 
id="no_table_address_type" name="address_type"><option 
value="">Vazio</option><option value="1">Comercial</option><option 
value="2">Residencial</option></select> -->
                
                <select class="form-control selectpicker"  
id="no_table_address_type" name="address_type" data-style="btn-info 
btn-outline-info">                                                              
              
                    {{for t in address_type_list:}}
                    <option value="{{=t.id}}">{{=t.type}}</option>
                    {{pass}}
                </select>
            </div>
            <div class="col-md-12 m-b-20">
                <select id="no_table_cities" name="cities" data-style="btn-info 
btn-outline-info" required>
                    {{for city in cities_list:}}
                    <option value="{{=city.id}}" >{{=city.name}}</option>
                    {{pass}}
                </select>
            </div>
            
            <!--form.custom.end -->
            <div class="hidden">
                {{=form.hidden_fields()}}
            </div>
        </div>
    
        <div class="modal-footer">
            <input class="btn btn-info" type="submit" value="Salvar">
            <button type="button" class="btn btn-default waves-effect" 
data-dismiss="modal">Cancelar</button>
        </div>
    </div>
</form>




now the problem: this selectpicker, simply my form can not store the value 
of select, when I add this class, I needed it, I do not need it that much, 
but it became a mission to understand what's happening here, I gave a print 
em form. vars.cities and she's just like None, help please

<Storage {'name': 'maria', 'cpf': '09102910', 'birthday': None, 'email': 
'rodgom...@gmail.com', 'registration_date' public_place ':' ',' '' '' '' '' 
'' '' '' '' '' 'cities': None, 'address_type': None, 'person': 4}>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to