I have this table db.define_table('evento', Field('titolo', requires=[IS_NOT_EMPTY()]), Field('verifica', type='boolean', default=False), Field('inizio', type='datetime', requires=IS_DATETIME(format=T('%d/%m/%Y %H:%M'),error_message='deve essere DD/MM/YYYY HH:MM!')), Field('fine', type='datetime', requires=IS_DATETIME(format=T('%d/%m/%Y %H:%M'),error_message='deve essere DD/MM/YYYY HH:MM!')), Field('uniqueid', type='string'), Field('ricorrenza', requires = IS_IN_SET(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'], error_message='deve essere un numero da 0 a 10'), default= '0'), Field.Virtual('giorno_inizio', lambda row:calendar.day_name[row.evento.inizio.weekday()]), Field('risorsa', 'reference risorsa'), Field('docente', 'reference auth_user'), Field('materia', 'reference materia'), Field('studenti', 'list:reference auth_user'), Field('colore', default = '#8080ff'), Field('controllato', type='boolean', default=False), Field('note'), auth.signature,singular="Evento",plural="Eventi",migrate='evento.table', format='%(titolo)s') db.evento.giorno_inizio.represent = lambda giorno_inizio, row: T(giorno_inizio)
When I create the form I need these requirements to these fields: db.evento.docente.requires=IS_IN_DB(db(query_docente),'auth_user.id','%(last_name)s' ' ' '%(first_name)s', zero=T('Scegli il docente/referente...')) and db.evento.docente.widget = wdg_select db.evento.materia.widget = wdg_select_change the field "materia" depends on the field "docente" and it's filled with a script like: url_materia = URL("dropdown.html") script = SCRIPT(""" var url_materia = "%s"; $('#evento_docente').on('change',function(e){ var v = $(this).val(); //alert('Docente cambiato: ' + v); $.web2py.component(url_materia + '?docente=' + v, 'evento_materia','no','no',$('#evento_materia')); }) """ % url_materia) To explain better "docente" is the teacher, and "materia" is the subject. Every docente has 1 or subject (materia) to teach so when I choose a "docente" the other field has to be filled only with the subjects teached by this teacher.... If the field "verifica" is true, I'd like to hidden the fields (BOTH) "docente" and "materia" and, so, I don't want the requirements. about these fields... With a conditional field I can hidden only the "docente" field but if it's hidden...after submit the form told me that is not correctly filled like required. I cannot hidden both field and not consider the requirements if the fields will be hidden.. Is it possible? Any suggestion? Thank you -- 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.