On item 2, you should be using css. give the "string" class a width in
ems or %. Stylize the font by setting font-size: 85%; or you can set
it to a certain number of ems or pt.

On Feb 5, 12:20 pm, sveinh <[email protected]> wrote:
> Thanks Massimo
>
> Your hint pointed me in the right direction.  It had a few topos,
> which I correct below.
>
> {{if not auth.user and not request.function=='user':}}
>                                 {{form=auth.login(next=URL(r=request, 
> args=request.args))}}
> {{pass}}
>
> This displays the default render of the login form. Great.
>
> However, I would like to customise the render of the form to display a
> different layout of the form if the user is not logged in. I guess I
> could use custom form for this. Example:
>
>                                 {{form=auth.login(next=URL(r=request, 
> args=request.args))}}
>                                 {{=form.custom.begin}}
>                                 {{=form.custom.label.username}}: 
> {{=form.custom.widget.username}}
>                                 {{=form.custom.label.password}}: 
> {{=form.custom.widget.password}}
>                                 Remember me: <input type="checkbox" 
> name="remember"
> id="auth_user_remember" class="checkbox" />
>                                 {{=form.custom.submit}}
>                                 {{=form.custom.end}}
>
> My two questions are:
>
> 1) The "remember" checkbox are not part of the form.custom.widget,
> thus in the example above, I wrote the standard html out instead of
> using the =form.custom... function. Is this standard behaviour? Or
> should I expect the "remember" widget to be present?
>
> 2) I would like to display smaller sized version of the username and
> password fields as opposed to the standard size of the input fields.
> Would this be possible using the custom.form.something='size="8"', or
> would I have to make a custom version of the example above like this:
>
>                                 {{form=auth.login(next=URL(r=request, 
> args=request.args))}}
>                                 {{=form.custom.begin}}
>                                 <input class="string" id="auth_user_username" 
> name="username"
> type="text" size="8" value="" />
>                                 <input class="password" 
> id="auth_user_password" name="password"
> type="password" size="8" value="" />
>                                 Remember: <input type="checkbox" 
> name="remember"
> id="auth_user_remember" class="checkbox" />
>                                 {{=form.custom.submit}}
>                                 {{=form.custom.end}}
>
> Again, thanks for the swift replies by this group!
>
> -sveinh
>
> On Feb 5, 3:33 pm, mdipierro <[email protected]> wrote:
>
> > in layout.html
>
> > {{if not auth.user and not request.function=='user':}}
> > {{=atuh.login(next=URL(r=request,args=args))}}
> > {{pass}}
>
> > On Feb 5, 3:40 am, sveinh <[email protected]> wrote:
>
> > > Hi all
>
> > > I would like to include a username+pw field and login button on all
> > > pages if the user is not already logged in. I would like to use the
> > > built-in functions of web2py to validate the login.
>
> > > What would be the best approach for this? I tried to create the fields
> > > (as default/user/login would produce) in template.html and set the
> > > form post action to default/user/login. This did no work. I guess
> > > there are some hidden fields which are not matched correctly in the
> > > user/login action which does not compute, and the user/login is
> > > displayed as if the user/login action was called for the first time.
>
> > > Thanks!
>
> > > -sveinh

-- 
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.

Reply via email to