Skip to content

Address Franky review findings on PR #3489 (subfield error handling) #3505

Description

@robin-the-going-merry

Requested by: @Crabcyborg

Franky review on PR #3489 (branch improve_subfield_error_handling, same repo, not a fork - push directly to that branch) requested changes on 2026-09-26. No commits have landed since, so none of the items below are fixed yet.

PR: #3489

Blocking

  1. js/formidable.min.js was never regenerated. Run npm run minimize and commit the rebuilt file - none of this PR JS validation changes take effect in production until it ships (FrmAppHelper::save_combined_js() builds off the .min.js, and js_suffix() returns .min whenever SCRIPT_DEBUG is off). Same issue as the precedent on formidable-forms#3408.

  2. Blur-validation regression - js/formidable.js:341. Once a combo field (Name/Address) moves from "all blank" to "some sub-fields blank", blurring a still-empty required sub-field silently clears its error instead of keeping it flagged. comboFieldHasFieldError() checks the outer combo wrapper for frm_blank_field, which is only set when all required sub-fields are empty - so in the "some blank" state it returns false, falls through, and removeFieldError() wipes the still-blank sub-field error. Repro: required Name field, First blank + Last filled, click into First, leave blank, blur.

  3. Repeater key collision - js/formidable.js:416. Inside a repeating section, getFieldId(input, true) collapses to the same key for every sub-field of one combo field (the sub-field-name segment never makes it into the key there, unlike the non-repeater branch). When two sub-fields of the same repeater row are both empty, the second checkRequiredField call overwrites the first entry, losing one sub-field error and mislabeling its location. Matches CodeRabbit review comment on this PR too.

Non-blocking

  • AJAX [if error] wrapper inconsistency - classes/controllers/FrmEntriesAJAXSubmitController.php:174. A sub-field error key like field12-first is not numeric, so maybe_modify_ajax_error() skips applying a site custom [if error] HTML wrapper for the new per-sub-field errors, while the "all blank" combined error still gets it.
  • Chosen.js CSS gap - css/_single_theme.css.php:396. The new error-clearing rule only targets input/select, missing textarea, .mce-edit-area iframe, .frm-g-recaptcha/.g-recaptcha iframe, .frm-card-element.StripeElement, and (when $use_chosen_js is on) .chosen-container-multi .chosen-choices / .chosen-container-single .chosen-single. An Address field state/country dropdown becomes .chosen-container-single when chosen.js is enabled - a filled state sub-field next to a blank required one keeps showing error styling. Suggested fix from the review:
    .<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) input:not(:focus),
    .<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) select:not(:focus),
    .<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) textarea:not(:focus),
    <?php if ( $use_chosen_js ) { ?>
    .<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) .chosen-container-single .chosen-single,
    <?php } ?>
    
  • Description used as grammatical subject - classes/models/fields/FrmFieldCombo.php:492. get_sub_field_label() substitutes the sub-field {name}_desc option verbatim into "[field_name] cannot be blank." That option is authored as caption text, not necessarily a short noun phrase - an admin-written sentence there produces a garbled error message. Not a regression, but worth a fallback to the plain label when the description does not read as a short phrase.
  • Reuse/simplification (not blocking): getComboFieldRequiredMessage re-derives a key getFieldContainerErrorKey already computes; maybeCombineComboFieldErrors re-runs checks its callers already ran; the "clone field, override name, call get_error_msg" pattern is duplicated between FrmFieldCombo::get_sub_field_error_msg() and FrmFieldsController::add_validation_messages().

CI note: shard 1 Cypress failure (Form Templates/FormTemplates.cy.js, an <svg> visibility timeout) is unrelated to this diff - not blocking.

Done means

Fixes pushed to improve_subfield_error_handling, js/formidable.min.js rebuilt and committed, and the franky-review label re-added for re-review.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions