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

PasswordFields issue -> second field takes value of first after submit


Go to End


5 Posts   1293 Views

Avatar
danzzz

Community Member, 175 Posts

27 April 2011 at 2:01am

hi,

I create the password fields this way:

$password_field = new ConfirmedPasswordField('Password','Password',NULL,NULL,NULL,'Password');

If I insert different values to both fields, I get the error that the fields dont match, thats ok so far.
But after submit in the second password field is the same value as in the first field ... and the user
can just submit again and the both pwds match ...

why that?

how to clear password fields after submit?

daniel

Avatar
dhensby

Community Member, 253 Posts

27 April 2011 at 2:17am

If you are writing straight into a member object, you can use SetPassword as the field name instead of Password.

Avatar
danzzz

Community Member, 175 Posts

28 April 2011 at 9:42am

hi pigeon,

sorry, I dont understand what you mean.
I submit my form and there are errors on the form because I typed in 2 different passwords - they dont match.

Password: john
Password again: john123

After submit my form is populated again with all the values I entered the first time. Also the 2 password fields are
populated again, but with this values:

Password: john
Password again: john

How I can avoid this? Or how can I clear the password fields after an error?

Avatar
dhensby

Community Member, 253 Posts

28 April 2011 at 8:21pm

I mean, try this:

$password_field = new ConfirmedPasswordField('SetPassword','Password',NULL,NULL,NULL,'Password');

Avatar
danzzz

Community Member, 175 Posts

29 April 2011 at 3:24am

no sorry, that dont work for me, still the same, after submitting in the second password field is the same value as in the first ...