Skip to:
Content

Opened 3 years ago

Closed 3 years ago

Last modified 5 months ago

#3378 closed defect (bug) (fixed)

Fix submitted values for text(area) and dropdown xprofile fields during registration

Reported by: r-a-y Owned by:
Milestone: 1.5 Priority: normal
Severity: normal Version: 1.5
Component: XProfile Keywords: has-patch
Cc:

Description

During registration, if you have a required text, textarea, selectbox or multi-selectbox xprofile field filled in and you do not successfully complete the form, on submission, these values are wiped out forcing the user to fill in the respective fields again.

The (multi)selectbox error has existed since BP 1.2; the
textbox / textarea error is actually a regression from BP 1.2.

Attached patch attempts to fix these issues and also finetunes a few more "for" loops missed from #2985.

Attachments (1)

3378.01.patch (6.2 KB) - added by r-a-y 3 years ago.

Download all attachments as: .zip

Change History (5)

r-a-y3 years ago

comment:1 DJPaul3 years ago

  • Milestone changed from Awaiting Review to 1.3

comment:2 DJPaul3 years ago

Thanks for this. I've tested it and fixed a few PHP warnings which I found.

I've also fixed a bug in (optional) text fields where, if that field's value is cleared and if another (required) field failed validation, it was restoring the value of that optional text field. Finally, I've changed the behaviour of the single-item select boxes to *not* show the "---" option if it is a required field, as it didn't make sense; picking it failed the form validation.

Last edited 3 years ago by DJPaul (previous) (diff)

comment:3 djpaul3 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4831]) Fix profile field value handling of existing settings and new values when form submission fails validation. Props r-a-y for patch.
Change select box behaviour to not show "---" placeholder when field is required.
Fixes #3378

comment:4 djpaul5 months ago

In 7599:

XProfile: Show the placeholder text for all select box profile fields.

Prior to BP 1.5, the "----" placeholder item for select boxes was shown for both optional and mandatory fields. In BP 1.5 in r4831, the behaviour was changed to only show the placeholder item for optional profile fields. With retrospect, that change didn’t make much sense.

This commits restores the original behaviour, showing the placeholder text for all select box profile fields. A user should be forced to pick an option for a required profile field, and not allow the web browser to automatically select the first option in the <select> element.

See #3378, #3698, and #5184. Props haykayltduk, hnla, DJPaul at WordCamp London contributor day!

Note: See TracTickets for help on using tickets.