THIS IS THE MODEL:
*db.define_table('evento',
SQLField('dono','reference auth_user',writable=False,readable=False),
SQLField('paciente', 'reference paciente'),
SQLField('titulo', 'string', length=255 ,default=''),
SQLField('data','date',default=request.now,readable=False),
SQLField('horario','time',readable=False),
SQLField('duracao','integer'),
SQLField('status', 'string', length=255 ,default='Marcado'),
SQLField('comentario', 'text',default=''),
SQLField('criado_por','reference
auth_user',writable=False,readable=False))*
db.evento.dono.requires=IS_IN_DB(db,'auth_user.id','auth_user.first_name',error_message=T('Escolha
um dono para o evento'))
db.evento.data.requires=[IS_NOT_EMPTY(),IS_DATE()]
db.evento.horario.requires=[IS_NOT_EMPTY(),IS_TIME()]
*from gluon.sqlhtml import AutocompleteWidget
db.evento.paciente.widget = AutocompleteWidget(request,db.paciente.nome,
db.paciente.id)*
CONTROLLER:
*def criar_evento():*
def update_page():
response.headers['web2py-component-command'] =
"jQuery('#TB_closeWindowButton').click();location.reload();"
try:
dono_id=int(request.get_vars.dono)
horario=request.get_vars.horario
except:
response.flash='Erro ao cadastrar evento'
form = SQLFORM(db.evento)
form.vars['criado_por']=auth.user.id
form.vars['horario']=horario
form.vars['dono']=dono_id
if form.accepts(request.post_vars, session):
update_page()
elif form.errors:
response.flash = 'Erro ao cadastrar evento'
*return form*
This is the VIEW CODE:
{{for i,k in enumerate(horarios):}}
<tr class={{='even' if i%2 else 'odd'}}>
<td>{{=k}}</td>
{{if horarios_preenchidos[k]:}}
<td>{{=horarios_preenchidos[k].titulo}}</td>
{{pass}}
{{if not horarios_preenchidos[k]:}}
<td> *{{=SPAN(A('add',_class='thickbox',
_title='Adicionar Evento',
_href='#TB_inline?
height=100&width=600&inlineId=modal_content_%s' %i),
DIV(LOAD('default','criar_evento?dono=%s;horario=%s'%(dono.id
,k),ajax=True),
_id='modal_content_%s' %i ,_class='hidden'))}} -->
{{=A('Example 1',
_href="criar_evento?dono=%s&horario=%s&keepThis=true&TB_iframe=true&height=320&width=600"
%(dono.id,k), _title="add a caption to title attribute / or leave blank",
_class="thickbox")}}*
</td>
{{pass}}
</tr>
{{pass}}
On Sun, Mar 21, 2010 at 11:42 AM, mdipierro <[email protected]> wrote:
> Can we see the code?
>
> On Mar 21, 8:50 am, Tito Garrido <[email protected]> wrote:
> > Hi,
> >
> > Is there a way to change the name of the field? I'm generating the same
> form
> > N times using LOAD... each form has different parameters for some fields.
> >
> > Thanks,
> >
> > Tito
> >
> >
> >
> > On Sun, Mar 21, 2010 at 12:20 AM, mdipierro <[email protected]>
> wrote:
> > > It should work with multiple fields as long they have different
> > > names.
> >
> > > On Mar 20, 8:41 pm, Tito Garrido <[email protected]> wrote:
> > > > Hi,
> >
> > > > I've created several forms using LOAD function... These forms has 1
> field
> > > > using AutocompleteWidget but this widget only works if there is just
> 1
> > > form
> > > > on the page...
> >
> > > > Is that expected?
> >
> > > > Regards,
> >
> > > > Tito
> >
> > > > --
> >
> > > > Linux User #387870
> > > > .........____
> > > > .... _/_õ|__|
> > > > ..º[ .-.___.-._| . . . .
> > > > .__( o)__( o).:_______
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "web2py-users" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<web2py%[email protected]>
> <web2py%[email protected]<web2py%[email protected]>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/web2py?hl=en.
> >
> > --
> >
> > Linux User #387870
> > .........____
> > .... _/_õ|__|
> > ..º[ .-.___.-._| . . . .
> > .__( o)__( o).:_______
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<web2py%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>
--
Linux User #387870
.........____
.... _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:_______
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.