• Hi Marco,

    First, please accept my sincere thanks and congratulations on this plugin. Very well done!

    I do however seem to run into some unexpected behavior while using it. I have read the docs, the FAQ and even part of the code trying to figure out how to solve it, but I’m not getting very far.

    I’m using Cimy EUF 2.1.1 and the problem occurs in various browsers.

    Problem description:
    I’ve added a number of extra fields to be filled in on the user profile, such as skype, twitter etc. For a number of those fields I have added (correct) regular expressions in the “Should be equal TO:” field and I have ticked the regex box.

    The validation works as expected and throws errors when the input in a field doesn’t validate.

    However, what I didn’t expect to happen:
    If one field throws a validation error, none of the other (correctly) filled in fields are updated AND when (re-)showing the user profile form with the validation error, all previously filled in information is lost.

    I’m not sure whether this happens as well if you add fields to the registration form as I don’t use that function, though I would expect so.

    An example to make it clearer:
    Say I have added a regex for the Twitter field.
    Now someone fills in an incorrect Twitter name, but also correctly fills in the fields for LinkedIN and Skype and submits the form.

    The form will be reloaded, will show the validation error at the top and will show the original (empty) values for the Twitter, LinkedIN and Skype fields.
    Instead I would have expected the submitted form values to be shown.

    Now the user will have to re-fill in all the fields they previously filled in and as I have added quite a number of extra fields, this is quite inconvenient for the user.

    Suggestion towards a possible solution:
    When deciding the values to be shown in the user profile (and registration) form, check whether the $_POST variable exists.
    If it exists, for each field check whether $_POST has a value for that field, if so, use those values, if not, use the values available in the database, if those don’t exist, use the default values if available.

    Please feel free to contact me if you would like me to provide more information, test a new version or even would like me to contribute some code towards the solution.

    Warm greetings,
    Juliette

    http://ww.wp.xz.cn/extend/plugins/cimy-user-extra-fields/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Marco Cimmino

    (@cimmo)

    Your behaviour happens correctly during registration, where user has no saved data.
    However this is not a real bug, most likely a design decision as I thought that user if sees already filed fields with new data but there is also an error will start to think:
    “Did it save the fields without errors or none of them are saved?”

    Point is none of them are saved until no errors appear due to WordPress design.
    So you really think your behaviour is easier to understand for the user?

    It is more likely a design decision. Convince me that your idea is better than mine.

    Hi Marco,

    Thank you for your reply.

    To me it is a usability issue. Having the content of all updated fields ‘disappear’ when there is a mistake in one, discourages users from filling in their profile, let alone trying it again.

    Also, as I stated before it is the expected behaviour when using forms (with the exception of password fields). In general when something goes wrong with forms, an error will be displayed at the top of the form, the error field will be highlighted in some way and the user will be given the chance to correct the error.

    The best solution to merge both your and my views would in my opinion be to save the correct fields and highlight the (unsaved) incorrect fields, but you say that is not possible due to WordPress design.
    Would you please be so kind as to explain that a bit further ? Do you use a specific WordPress function for the saving which saves everything at once ? Is there a way to overwrite or bypass that function or is there a specific reason that it is imperative to use that function ?

    What about the following as an solution meeting halfway:

    • Strengthen the error message at the top a bit – for instance add “NO INFORMATION WAS UPDATED” as a first/last line if there are errors.
    • Display the changed values, but add a yellow background to the <tr>’s for the correctly changed values and a red background to the <tr>’s with incorrect values.
      That would require injecting ‘class=”notsaved/incorrect”‘ in the <tr> and adding css rules for .form-table TR .notsaved and .form-table TR .incorrect.

    This way, there can be no confusion on whether or not the values have been saved while at the same time giving the user to opportunity to correct the errors without having to fill in all fields again.

    Does this help ?

    Smile,
    Juliette

    Plugin Author Marco Cimmino

    (@cimmo)

    Hi Juliette,
    I think your vision is not the right one until you propose a change in WordPress itself.

    Why? Try this:
    1. disable my plug-in
    2. go to your own profile
    3. change the email address to something illegal like: ‘ciao@@@ciao.it$’
    4. change also some other fields
    5. hit update

    what happens? Exactly same behaviour as my plug-in.
    So changing the way as you want would be not consistent with WordPress behaviour that means confusion.

    So I would prefer you file a Feature Request against WordPress bug tracker instead of my plug-in.

    Smile,
    Marco

    Hi Marco,

    Thanks for your reply. I agree with your premise that the plugin should be in line with the WordPress default behaviour and that this is therefore a bug in WordPress.

    I didn’t realize that this was WordPress behaviour as there is very little validation in the default WordPress fields and I had never mistyped my email 😉

    Thank you for explaining this. I will try and check if a WordPress bug report / feature request on this issue has been made and if not, will submit one of my own.

    Sunny greetings,
    Juliette

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: Cimy User Extra Fields][Bug] Profileform loses input / validation error’ is closed to new replies.