Assuming the standard user() function:

    form = auth()
    if request.args(0) == 'login':
        form.element('input.password')['_placeholder'] = 'Password'

Not sure placeholders will show in plain text in all browsers -- may need a 
JS workaround for that (change the field type dynamically to text on blur).

Anthony

On Saturday, December 17, 2011 1:20:21 AM UTC-5, Abhishek Gupta wrote:
>
> Hello
>
> I am customizing web2py login form, but appear to stuck with this one.
>
> In a normal HTML5 form, for password I can do following:
>                    <input type="password" name="cpassword" id="cpassword" 
> placeholder="Re-password" />
>
> But how can i add a similar placeholder field to the web2py login form for 
> the password field. I was able to do the same for the username field using 
> the following function :
>
> $('#auth_user_username').each(function() {
>
>        var default_value = "Username";
>        $(this).focus(function(){
>                if(this.value == default_value) {
>                        this.value = '';
>                }
>        });
>
>        $(this).blur(function(){
>                if(this.value == '') {
>                        this.value = default_value;
>                }
>        });
> });
>

Reply via email to