• Resolved matthew1984

    (@matthew1984)


    If I have a mfield marked as required, but nested in a conditional group that is not triggered on the frontend (so a required mfield in a group thats not being used due to conditional logic), I cannot complete the form, I get the β€œONE OR MORE FIELDS HAVE AN ERROR. PLEASE CHECK AND TRY AGAIN.” error, hoping you could advise. It should only validate if the uploader is visible or the condition group shows based on the plugin conditional value.

    My code:


    [select* your-type-of-entity "" "Pty (Ltd)" "CC" "Trust"]

    [group group-entity-type-pty class:cu-col-span-12]

    [mfile* reg-cert id:reg-cert filetypes:jpeg|png|jpg|pdf blacklist-types:exe|bat|com max-file:10]

    [mfile* company-id id:company-id filetypes:jpeg|png|jpg|pdf blacklist-types:exe|bat|com max-file:10]

    [mfile* organogram id:organogram filetypes:jpeg|png|jpg|pdf blacklist-types:exe|bat|com max-file:2]

    [mfile* pty-address id:pty-address filetypes:jpeg|png|jpg|pdf blacklist-types:exe|bat|com max-file:2]

    [/group]

    [group group-entity-type-cc class:cu-col-span-12]

    [mfile* reg-cert id:reg-cert filetypes:jpeg|png|jpg|pdf blacklist-types:exe|bat|com max-file:10]

    [mfile* company-id id:company-id filetypes:jpeg|png|jpg|pdf blacklist-types:exe|bat|com max-file:10]

    [mfile* company-address i:cc-address filetypes:jpeg|png|jpg|pdf blacklist-types:exe|bat|com max-file:2]

    [/group]

    [group group-entity-type-trust class:cu-col-span-12]

    [mfile* trust-deed id:trust-deed filetypes:jpeg|png|jpg|pdf blacklist-types:exe|bat|com max-file:10]

    [mfile* company-id id:company-id filetypes:jpeg|png|jpg|pdf blacklist-types:exe|bat|com max-file:10]

    [mfile trust-loa id:trust-loa filetypes:jpeg|png|jpg|pdf blacklist-types:exe|bat|com max-file:10]

    [/group]

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Glen Don Mongaya

    (@glenwpcoder)

    Thanks for reaching out @matthew1984 .

    Could you please send me also your Conditional setup/settings? using text format?
    So I can test and replicate on my local.

    Thread Starter matthew1984

    (@matthew1984)

    Thank you so much for the response @glenwpcoder. Here are my conditional field settings:

    show [group-trading-address] if [your-trading-address] equals “Yes”
    show [group-entity-type-pty] if [your-type-of-entity] equals “Pty (Ltd)”
    show [group-entity-type-cc] if [your-type-of-entity] equals “CC”
    show [group-entity-type-trust] if [your-type-of-entity] equals “Trust”
    show [group-foreign-tax] if [tax-residence-other] equals “Yes”
    show [group-source-of-funds-other] if [your-source-of-funds] equals “Other”
    show [group-rsa-id] if [your-sa-citizen] equals “Yes”
    show [group-passport] if [your-sa-citizen] equals “No”

    Thread Starter matthew1984

    (@matthew1984)

    @glenwpcoder. The show/hide of the conditional fields is working perfectly, it’s just still trying to validate required fields that are in the hidden entity groups. Thanks for the help.

    Thread Starter matthew1984

    (@matthew1984)

    Hi @glenwpcoder – just following up on this thank you kindly.

    Plugin Author Glen Don Mongaya

    (@glenwpcoder)

    @matthew1984 sure will give you an update tomorrow.

    Plugin Author Glen Don Mongaya

    (@glenwpcoder)

    Hi @matthew1984 , Can you try this version before I officially release it to the repo? Let me know if it works on your end.

    https://www.dropbox.com/scl/fi/9oxmm26f0mazj5h63w263/drag-and-drop-multiple-file-upload-contact-form-7.zip?rlkey=xptymadet71nf3deuf44p2wyq&st=itvm5puj&dl=0

    Please let me know.

    Thread Starter matthew1984

    (@matthew1984)

    Thanks for the update @glenwpcoder it’s working perfectly! πŸ™‚

    Hi @glenwpcoder , I believe that this change created another issue, because in the new version no required field is validated if there is at least one mfile field inside a conditional group.

    For example:
    [mfile* file-cv filetypes:jpg|jpeg|png|heic|pdf|docx min-file:1 max-file:1]
    [group group-passed-medat-yes][mfile file-medat-result filetypes:jpg|jpeg|png|heic|pdf|docx max-file:1][/group]

    Here, the file-cv field is not validated and the form can be sent with no uploaded file.
    If I remove the conditional group, the file-cv field is validated correctly.

    I think the code in inc/dnd-upload-cf7.php:741 should read something like this (not thoroughly tested, but seems to work for me)

    if ( is_null( $multiple_files ) && $tag->is_required() && $group_fields ) {
    // check if field is visible and should be validated
    $validate = true;
    foreach ( $group_fields as $group_name => $fields ) {
    if ( in_array( $group_name, $hidden_groups ) && in_array( $name, $fields ) ) {
    // field is in hidden group
    $validate = false;
    break;
    }
    }
    // short circuit, should not be validated
    if (!$validate) {
    return $result;
    }
    }
Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘File Upload required fields conflicts with Conditional Fields for CF7’ is closed to new replies.