Skip to content

[ADD] website_hr_recruitment_ux: phone min-length validation on job application form#66

Closed
mav-adhoc wants to merge 5 commits into
ingadhoc:19.0from
adhoc-dev:19.0-h-120801-mav
Closed

[ADD] website_hr_recruitment_ux: phone min-length validation on job application form#66
mav-adhoc wants to merge 5 commits into
ingadhoc:19.0from
adhoc-dev:19.0-h-120801-mav

Conversation

@mav-adhoc

Copy link
Copy Markdown
Contributor

Summary

Adds the website_hr_recruitment_ux module to fix a bug in the public job application form where the phone field could be submitted containing only a country prefix (e.g. +54), causing two cascading issues:

  1. False "already applied" warningcheck_recent_application uses exact equality on the raw partner_phone value, so every applicant who submitted +54 matches every other, triggering the duplicate-application message incorrectly.
  2. Inflated application_count_compute_partner_phone_sanitized falls back to the raw value when _phone_format cannot parse a bare prefix, causing _compute_application_count to group unrelated applicants together.

Changes

  • Template override (views/website_hr_recruitment_templates.xml): inherits website_hr_recruitment.apply and adds minlength="7" to the partner_phone input. The browser blocks form submission when only the auto-filled country prefix is present.
  • JS patch (static/src/interactions/hr_recruitment_form.js): patches HrRecruitmentForm.checkRedundant to skip the RPC call when the phone value is shorter than 7 characters, preventing the false "already applied" toast from firing on focusout.

The module depends on hr_recruitment_ux + website_hr_recruitment and uses auto_install: True so it activates automatically whenever both are present.

Test plan

  1. Navigate to a public job offer page on the website.
  2. Fill in Name and Email, leave the Phone field with only the auto-filled country prefix (e.g. +54).
  3. Tab out of the Phone field — verify no "already applied" warning appears.
  4. Click the Apply button — verify the browser shows a native validation error on the Phone field and the form is not submitted.
  5. Enter a complete phone number (e.g. +54 9 11 1234-5678) and submit — verify the application goes through normally.

…lication form

Prevents submitting the public application form with only a country prefix
(e.g. +54) in the phone field, which caused false duplicate-application
warnings and inflated application counts.

- Template: adds minlength="7" to the partner_phone input so the browser
  blocks submission when only the auto-filled prefix is present.
- JS: patches HrRecruitmentForm.checkRedundant to skip the RPC call when
  the phone value is shorter than the minimum, avoiding the false
  "already applied" warning on focusout.
@roboadhoc

Copy link
Copy Markdown
Contributor

Pull request status dashboard

…ectly

hr_recruitment_ux is not guaranteed to be present in every build;
website_hr_recruitment already pulls in hr_recruitment transitively.
…sage with translated one

setCustomValidity on the invalid event replaces the browser-native
'Please lengthen this text to 7 characters or more' with the
translatable string already defined in i18n/.
@les-adhoc

Copy link
Copy Markdown

@roboadhoc r+ nobump

@roboadhoc

Copy link
Copy Markdown
Contributor

@mav-adhoc @les-adhoc because this PR has multiple commits, I need to know how to merge it:

  • merge to merge directly, using the PR as merge commit message
  • rebase-merge to rebase and merge, using the PR as merge commit message
  • rebase-ff to rebase and fast-forward

@les-adhoc

Copy link
Copy Markdown

@roboadhoc rebase-ff

roboadhoc pushed a commit that referenced this pull request Jun 22, 2026
…lication form

Prevents submitting the public application form with only a country prefix
(e.g. +54) in the phone field, which caused false duplicate-application
warnings and inflated application counts.

- Template: adds minlength="7" to the partner_phone input so the browser
  blocks submission when only the auto-filled prefix is present.
- JS: patches HrRecruitmentForm.checkRedundant to skip the RPC call when
  the phone value is shorter than the minimum, avoiding the false
  "already applied" warning on focusout.

Part-of: #66
Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
roboadhoc pushed a commit that referenced this pull request Jun 22, 2026
…ectly

hr_recruitment_ux is not guaranteed to be present in every build;
website_hr_recruitment already pulls in hr_recruitment transitively.

Part-of: #66
Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
roboadhoc pushed a commit that referenced this pull request Jun 22, 2026
…lidation message

Part-of: #66
Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
roboadhoc pushed a commit that referenced this pull request Jun 22, 2026
…sage with translated one

setCustomValidity on the invalid event replaces the browser-native
'Please lengthen this text to 7 characters or more' with the
translatable string already defined in i18n/.

Part-of: #66
Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
@roboadhoc

Copy link
Copy Markdown
Contributor

Merge method set to rebase and fast-forward.

@roboadhoc roboadhoc closed this in 8e3d6b7 Jun 22, 2026
@roboadhoc roboadhoc added the 18.1 label Jun 22, 2026
@roboadhoc roboadhoc deleted the 19.0-h-120801-mav branch June 22, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants