Skip to content

Adds missing description of second client side form validation function parameter#593

Open
pjdevries wants to merge 1 commit intojoomla:mainfrom
pjdevries:forms-client-side-validation-custom-routine
Open

Adds missing description of second client side form validation function parameter#593
pjdevries wants to merge 1 commit intojoomla:mainfrom
pjdevries:forms-client-side-validation-custom-routine

Conversation

@pjdevries
Copy link
Copy Markdown

A custom client side form validation routine receives two parameters. Only the first one, the field value was documented. This PR documents the HTML element which is passed as the second parameter to the validation function.

@qodo-code-review
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Document second parameter in custom form validation functions

📝 Documentation

Grey Divider

Walkthroughs

Description
• Documents the element parameter in custom validation functions
• Updates code example to show both value and element parameters
• Clarifies that HTML element is passed as second parameter
Diagram
flowchart LR
  A["Custom Validation Function"] -->|receives| B["value parameter"]
  A -->|receives| C["element parameter"]
  D["Documentation"] -->|updated to explain| C
  E["Code Example"] -->|updated to show| C
Loading

Grey Divider

File Changes

1. docs/general-concepts/forms/client-side-validation.md 📝 Documentation +2/-2

Document element parameter in validation function

• Added documentation for the element parameter passed to custom validation functions
• Updated the explanatory text to describe both value and element parameters
• Modified code example to include element parameter in function signature
• Clarified that the function should return true or false for validation result

docs/general-concepts/forms/client-side-validation.md


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review bot commented Mar 11, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Versioned docs not updated 🐞 Bug ✓ Correctness
Description
The PR updates only /docs (the upcoming-release manual) to document the element parameter for
formvalidator.setHandler callbacks, but the supported versioned manuals still describe only the
single value parameter, leaving inconsistent guidance across versions. This contradicts the repo’s
documented process to replicate relevant doc fixes into the latest release and other agreed
supported versions before merging.
Code

docs/general-concepts/forms/client-side-validation.md[R102-107]

+1. Step 1 Write the js function. (Although a regex is used below, you're obviously not limited to this). The value of the field is passed in the `value` parameter. The HTML element corresponding to the field is passed in the `element` parameter. The function should return `true` if the value is valid, or `false` if it isn't. 

```js title="no-uppercase.js"
window.onload = (event) => {
    document.formvalidator.setHandler('noUppercase',
-        function (value) {
+        function (value, element) {
Evidence
The updated unversioned doc now states the handler receives (value, element) and shows the
signature accordingly, but the versioned docs for 6.0 (latest full release) and 5.4 (previous major)
still show only function (value) and only mention the value parameter. The repo’s own versioning
guidelines explicitly say changes relevant to multiple Joomla versions should be duplicated into the
latest release and other agreed versions, not only /docs.

docs/general-concepts/forms/client-side-validation.md[100-108]
versioned_docs/version-6.0/general-concepts/forms/client-side-validation.md[100-108]
versioned_docs/version-5.4/general-concepts/forms/client-side-validation.md[100-108]
about/versioning.md[10-30]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The PR updates only the unversioned `/docs` page, but the corresponding versioned manuals (notably 6.0 and 5.4) still document the single-parameter callback signature. This leaves readers of released-version documentation with inconsistent/incorrect guidance.

### Issue Context
This repo’s own versioning guidance says doc changes relevant to multiple Joomla versions should be duplicated into multiple versions (latest full release, upcoming release, and previous major) before merging.

### Fix Focus Areas
- versioned_docs/version-6.0/general-concepts/forms/client-side-validation.md[100-108]
- versioned_docs/version-5.4/general-concepts/forms/client-side-validation.md[100-108]
- (optional) about/versioning.md[17-30] (only if you want to add a note clarifying the intended workflow for this specific change)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@robbiejackson
Copy link
Copy Markdown
Contributor

Thanks for fixing this.

Could you please include these changes in the other versions as well, then we can merge this. That is, in the equivalent client-side-validation.md file under versioned_docs/version-4.4, versioned_docs/version-5.4 and versioned_docs/version-6.0.

Those are the other versions we're also maintaining at the moment.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants