Skip to content

Add autocomplete attribute to name field#2592

Closed
truongwp wants to merge 1 commit into
masterfrom
add-name-field-autocomplete
Closed

Add autocomplete attribute to name field#2592
truongwp wants to merge 1 commit into
masterfrom
add-name-field-autocomplete

Conversation

@truongwp
Copy link
Copy Markdown
Contributor

@truongwp truongwp requested a review from Crabcyborg November 19, 2025 19:23
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 19, 2025

Walkthrough

The pull request adds autocomplete attribute support to form name fields. The first and last name subfield definitions are restructured to include autocomplete metadata (given-name and family-name), and the combo-field template is updated to render this autocomplete attribute on form inputs.

Changes

Cohort / File(s) Summary
Field Definition Updates
classes/models/fields/FrmFieldName.php
Modified first and last name subfield definitions from plain string labels to structured arrays containing both label and autocomplete attributes.
Template Rendering
classes/views/frm-fields/front-end/combo-field/combo-field.php
Added logic to detect and render per-sub-field autocomplete attributes in the input element markup.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Straightforward data structure change with clear purpose
  • Template modification follows existing rendering patterns
  • Changes are cohesive and localized to two files

Possibly related PRs

Suggested labels

run analysis, run tests

Suggested reviewers

  • Crabcyborg

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding autocomplete attributes to name field subfields (first and last names).
Description check ✅ Passed The description references a related issue and is directly relevant to the changeset, which implements autocomplete functionality for the name field.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-name-field-autocomplete

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 PHPStan (2.1.32)

Invalid configuration:
Unexpected item 'parameters › strictRules'.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
classes/models/fields/FrmFieldName.php (1)

40-48: Parent class correctly handles mixed array/string format—optional refactor improves consistency.

Verification confirms FrmFieldCombo::register_sub_fields() properly normalizes both array and string formats (FrmFieldCombo.php lines 61-72), so the data structure change is compatible. All downstream access patterns treat sub_fields as arrays, which works correctly.

The 'middle' field uses string format while 'first' and 'last' are now arrays. While this mixed format functions correctly, adding autocomplete support to the middle field improves consistency:

-				'middle' => __( 'Middle Name', 'formidable' ),
+				'middle' => array(
+					'label'        => __( 'Middle Name', 'formidable' ),
+					'autocomplete' => 'additional-name',
+				),
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d9a590b and 9ff63bf.

📒 Files selected for processing (2)
  • classes/models/fields/FrmFieldName.php (1 hunks)
  • classes/views/frm-fields/front-end/combo-field/combo-field.php (1 hunks)
🔇 Additional comments (1)
classes/views/frm-fields/front-end/combo-field/combo-field.php (1)

72-74: LGTM! Clean implementation of autocomplete support.

The conditional attribute addition follows the existing pattern and correctly delegates HTML escaping to FrmAppHelper::array_to_html_params() on line 77. This enhances UX by enabling browser autofill for name fields.

@truongwp
Copy link
Copy Markdown
Contributor Author

Closing this because of a new solution #2595

@truongwp truongwp closed this Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant