BuddyDev

Search

[Resolved] Conditional Fields + Profile Completion won’t work with required fields

  • Participant
    Level: Initiated
    Posts: 1
    Lisa Selina on #48925

    Hey I am using BuddyBoss along Plugins like Profile Completion and Conditional Fields. However when I want to have a field marked as “required” which is only shown when a special condition is met it won’t allow to save the profile.
    For example: I have 3 Profile Tabs: “Sign Up”, “Me” and “Partner”. The first tab only contains a “Username”-field which is for the registration.
    The second tab has the “Gender”-field with a third option “Couple”. Below this field is a second “Gender”-field (Drop down with custom fields “male” and “female”) which has the condition to only show up when “Couple” is selected in the real “Gender”-field. Both fields are set to required.
    However after profile activation you are forced to edit all required fields which is intended. As soon as you fill in all required information and hit “Save changes” it won’t save and the second gender-field won’t show up.

    How can I solve this problem without creating another fieldset or disable profile completion or make those fields optional?

    This might be a stupid question with a simple solution but I have no coding experience and this is somekind of a hobby project of mine. I’ve been trying to find a solution myself like being able to have a couple-profile with 2 separat sections for both users but in this case I couldn’t find anything and I am lost.
    Thank you guys in advance.

  • Keymaster
    (BuddyDev Team)
    Posts: 23284
    Brajesh Singh on #48928

    Hi Lisa,
    Welcome to BuddyDev support forums.

    I am sorry but the only way to achieve it is to mark the dependent fields(fields which may be hidden) as “not required”.

    In the above use case, it means if you mark the second Gender field as optional, the conditional field will work.

    The reason for form submission not working when a required field is hidden is related to how the markup is generated by BuddyBoss/BuddyPress. They add a “required” attribute to the generated input, so the browser does not allow submission of the form if it is not filled.

    Please let me know if you can mark the 2nd gender field optional.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 1
    Lisa Selina on #48953

    Hey Brajesh, thank you for your response. Ok so I made it optional and now it works at least for this field set. The other field set won’t save, even if all required are shown and filled in.
    I guess I will keep it just to male and female and my users have to make 2 accounts and they can use buddy circle to show they’re a couple.
    But thank you none the less for your support 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 23284
    Brajesh Singh on #48961

    Hi Lisa,
    Thank you.

    I am not sure of the issue with the other field groups. Can you please disable the profile completion plugin temporarily and check if that makes it work?
    If you have a staging site, Please do link me. I will be glad to test and see if I may be able to assist.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved