BuddyDev

Search

Conditonal Profile Fields – Issues on profile fields on page reload when error

  • Participant
    Level: Initiated
    Posts: 19
    Brett on #8810

    Hi Brajesh,

    I have a problem with the Conditional Fields plugin (or believe it to be) that when there is an issue with a required field, and when the page reloads with the field values that were there prior to the save.

    The user has to then select another value in the dropdown field I am using, and reselect their original value for the relevant fields to display again. On the initial page load, the user selects the relevant item from the drop down list, and all works without issue, it’s only if there is an issue with a required field that it does not load the page properly.
    I have set my fields to be available to the relevant member types, and those without a member type value (ie before the value is saved the first time around)

    I have had to run a check on the field values in your plugin, as it does not handle the member type Xprofile field type very well. It would not save any of the values when this was not included.

    What is going wrong the plugin, or my code?

  • Keymaster
    (BuddyDev Team)
    Posts: 21520
    Brajesh Singh on #8906

    Hi Brett,
    Thank you for posting.

    1. Currently the plugin only supports core BuddyPress field. We do plan to add support for custom field type in future.

    2. It will not work if you have a field marked as required and which is controlled by conditions. The best way is to not mark conditional fields as required. We understand that you still want to validate that field. Please see the below topic for an example of validation

    https://buddydev.com/support/forums/topic/conditional-profile-fields/#post-8209

    yours can be simpler than that.

    If you need assistance with code, please do post me the field ids and the details for validation and I will help.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 19
    Brett on #8917

    Thanks for the example, I understand the code, but this is once the account is already created. They are editing their profile, rather than signing up, so the sign up validation hook isn’t going to work.

    The field in question that gets hidden depending on the value is 56, and the field that it depends on for this is 6.

  • Participant
    Level: Initiated
    Posts: 19
    Brett on #9057

    Brajesh,

    Is there a way to fire off the trigger that shows the fields, when the profile form is reloaded after an error, and loads the values that were entered before the error?

    This is what is not doing on a page reload when a required profile field has an error.

    • This reply was modified 5 years, 3 months ago by Brett. Reason: Incorrectly marked as resolved and provided incorrect information
  • Keymaster
    (BuddyDev Team)
    Posts: 21520
    Brajesh Singh on #9076

    Hi Brett,
    1. I have marked it as unresolved.

    2. If I assist with your previous reply #8917, will that help in resolving the last?

    I am putting some example for the profile update validation too today.

  • Participant
    Level: Initiated
    Posts: 19
    Brett on #9094

    I hope so!
    The issue only rears it’s head when there is an error with required fields, and when BuddyPress reloads the form with the submitted values that existed before the error, your plugin doesn’t appear to be triggered to show the conditional fields.

    I don’t think I need assistance with the validation, as I have javascript that deals with that, unless my two lots of javascript that deal with 1 – hiding field 56 if field 6 is set to a certain value (using the change event) and 2 – Hiding field 56 on page load if it is set to that same vaue

    If needed, I can provide those.

    All the fields are dependent on that value displayed in field 6. It appears to be that since the page is reloading with a value that is not yet saved in the xprofile field, that it does not treat it properly.

  • Participant
    Level: Initiated
    Posts: 19
    Brett on #9169

    Brajesh,

    Whilst I no longer need this (I used jquery to make my fields required, so that it does the validation before the form is submitted) I still think this is a bug.

  • Keymaster
    (BuddyDev Team)
    Posts: 21520
    Brajesh Singh on #9218

    Hi Brett,
    I am sorry for not updating it.
    This plugin needs rewrite. We will be releasing an update in early June that fixes all bugs and adds support for the xprofile custom field types/our member type plugins.

    Thank you.

You must be logged in to reply to this topic.

This topic is: not resolved