Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

hiding value in ConfirmedPasswordField


Go to End


940 Views

Avatar
sajok

Community Member, 82 Posts

6 July 2012 at 9:52am

Edited: 06/07/2012 10:04am

Hello,

I have a member profile edit page with a ConfirmedPasswordField that shows two fields to check the password. The problem is when a member visits this page to edit their profile, they see both password fields with long dotted passwords. I tried to hide that password value and show blank fields instead using this code:


        $password = new ConfirmedPasswordField('Password',null,null,null,false);

        $password->setCanBeEmpty(true);

        $member->Password = ''; 

this works and shows blank password fields, but when I save the form without making any changes, the password get overridden and I can no longer login with the old password.

In this api page for the ConfirmedPasswordField class, somebody suggested to add $member->Password = ''; before $form>saveInto() and not calling writ(), but the write call() is already their under saveInto();

I just want to shows black fields for password instead of the long dotted value.. any help?