After looking in the documentation and in the source (on how PluginMModal
calls jquery) I've tried this approach that still doesn't work yet (no
error messages) but maybe it's better to get suggestions (using the same
user.html below)
auth.settings.extra_fields['auth_user']= [
Field('accept_privacy','boolean',default=False,label=DIV('click me!',
_onclick='jQuery(#%s).fadeIn(); return false' % request.cid))]
Marco
On Tuesday, August 7, 2012 5:05:04 PM UTC+2, Marco Prosperi wrote:
>
>
>> Maybe show what you tried. I would think you could make either the field
>> label or comment (the comment appears after the input field) a link, and
>> trigger the modal dialog with an onclick attribute or a jQuery event
>> handler.
>>
>> Anthony
>>
>
> ok,
> in models/db.py I have put (but the link in comment doesn't work):
>
> auth.settings.extra_fields['auth_user']= [
> Field('accept_conditions','boolean',default=False,label='accept
> conditions', comment=A('view
> conditions',callback=URL('a.link("conditions")'),target="web2py_user_form"))]
>
> and I have a view/default/user.html like this (you can see
> {{=a.link('conditions')}} just put for testing and it works correctly but
> is not what I want, because is a string not related to a check box and a
> database field)
>
>
> {{extend 'layout.html'}}
> <h2>{{=T( request.args(0).replace('_',' ').capitalize() )}}</h2>
> <div id="web2py_user_form">
> {{=form}}
> {{if request.args(0)=='register':}}
> {{a=PluginMModal(title='Conditions',content="""bla bla
> bla""",close='Close',width=70,height=70)}}
> {{=a}}
>
> I accept {{=a.link('conditions')}}
>
>
> {{pass}}
> {{if request.args(0)=='login':}}
> {{if not 'register' in auth.settings.actions_disabled:}}
> <br/><a href="{{=URL(r=request,args='register')}}">{{=T('register')}}</a>
> {{pass}}
>
> {{if not 'request_reset_password' in auth.settings.actions_disabled:}}
> <br/><a
> href="{{=URL(r=request,args='request_reset_password')}}">{{=T('lost
> password?')}}</a>
> {{pass}}
> {{pass}}
> </div>
>
> <script language="javascript">
> <!--
> jQuery("#web2py_user_form input:visible:enabled:first").focus();
> //-->
> </script>
>
>
--