BuddyDev

Search

Question to the Buddypress Conditional logic Plugin

  • Participant
    Level: Enlightened
    Posts: 44
    Alex on #52312

    Hi, I have the following scenario at the reg form:
    Its just an example to show what I mean.

    A user is asked about his pets with a multiple drop down list (required):
    1 dog
    2 cat
    3 other pet
    If the user choses “other pet” another field should show up which asking him “what kind of pet?”

    So far so good. When the user klicks “other pet” he should be forced to fill up the “what kind of pet” textbox. This works BUT when the user choses “cat”, he shouldn’t be asked anymore and the reg form should be processed without filling out the “what kind of pet” textbox.

    This doesn’t work. Instead of – the user cannont register without any message because he don’t sees the “what kind of pet” question, which is required only when he has chosen “other pet” of the given list.

    So the logic should be, if the user already choses any of the given pets the form should be processed. If he choses other pet, he should be asked for that and then the form should be processed.

    Is it difficult to implement that?

  • Keymaster
    (BuddyDev Team)
    Posts: 24599
    Brajesh Singh on #52320

    Hi Alex,
    Thank you for the post.

    This is a core issue with BuddyPress/BuddyBoss. They add ‘required’ html attribute to input elements if a field is marked as required in create/edit screen. There is no proper way to filter that out and remove.

    So, you can not use any conditions that may hide a required field. You will need to ensure that the fields which may get hidden are not marked required.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 44
    Alex on #52327

    Sorry, to ask once more.
    No way to add some code wich is like “bypass submit for a field which is required and hidden”?

    I saw conditional logic like that at the register pages from Gravity forms which sync to Buddypress xfields but to get this plugin just for that feature is beyond my budget.

  • Keymaster
    (BuddyDev Team)
    Posts: 24599
    Brajesh Singh on #52329

    Hi Alex,
    Thank you.

    If the fields were rendered by us, we could do it easily. BuddyBoss/BuddyPress makes it very difficult to filter the generated field attributes(required html attribute).

    Technically, It is not difficult, have server side validation for required and avoid putting it in html. We have done similar thing with our forms.

    In case of Gravity form, It is their form, so they can easily avoid this issue.
    Is it still doable with BuddyPress/BuddyBoss? Yes, it is. Filtering over bp_xprofile_field_edit_html_elements and un-setting/removing required, area-required will make it work. It is not straight forward and we are unable to put it in the plugin/supply code due to time constraints.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved