forms that intentionally reuse a key with mutually exclusive conditionals
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 64/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- react, typescript
- Domaine
- frontend
Piste de recherche
Reproduce the issue with the two mutually exclusive name fields in the report, using a blank submission. Start by tracing the visibility check and clearComponentOnHide() behavior described in the issue, then follow how deleteValue() affects the shared key. Done means entering a valid name no longer clears the shared value or triggers the required-field validation message.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
I was using Formio/React 5.3.0 but when I upgraded to 6.2.1 I found that duplicate key reuse for mutually exclusive conditions always throws validation error.
In @formio/react 5.3.0 (formiojs 4), clearOnHide only runs when visibility changes:
if (this.visible !== visible) {
this.visible = visible; // setter may clear
}
Once the edit field is already hidden, later condition checks leave data.name alone, so the create field keeps working.
In @formio/react 6.2.1 (@formio/js 5), every condition check clears a hidden field:
if (this.visible !== visible) {
this.visible = visible;
}
this.clearComponentOnHide(); // always, while hidden
So on create, the hidden edit name repeatedly does deleteValue() on the shared data.name. The create field then fails required, and customMessage makes it look like the pattern error.
below is my two components with the same name but conditional:
{
"key": "name",
"type": "textfield",
"input": true,
"label": "Name",
"disabled": true,
"validate": {
"pattern": "^[a-zA-Z0-9\\s]*$",
"required": true,
"maxLength": 80,
"customMessage": "Invalid name; must contain only letters, numbers or spaces "
},
"autofocus": true,
"tableView": true,
"spellcheck": false,
"showCharCount": true,
"customConditional": "show = data.submissionUuid.length > 0",
"hideOnChildrenHidden": false
},
{
"key": "name",
"type": "textfield",
"input": true,
"label": "Name",
"validate": {
"pattern": "^[a-zA-Z0-9\\s]*$",
"required": true,
"maxLength": 80,
"customMessage": "Invalid name; must contain only letters, numbers or spaces "
},
"autofocus": true,
"tableView": true,
"spellcheck": false,
"showCharCount": true,
"customConditional": "show = data.submissionUuid.length === 0",
"hideOnChildrenHidden": false
}
To Reproduce
Steps to reproduce the behavior:
- create a form with customConditionals has shown above
- use that form with a Form component with no submission data or a blank object.
- on entry of the name you will always get the customMessage.
Expected behavior
I would expect it not to deleteValue() on the shared data.name so we will not get a custom validation message if the text entered is valid.
Screenshots
here is a screen shot of what i with mutually exclusive conditionals
- Langage dominant
- TypeScript
- Étoiles
- 371
- Forks
- 309
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de formio/react
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
-
onChange `modified` property remains false when file component is updatedPeut-être à nouveau libre @ZenMasterJacob20011 l’a pris il y a 293 jours, et aucune pull request n’est ouverte. Ouverte
-
FormBuilder onChange callback not triggered when options prop is providedPeut-être à nouveau libre @Victoriya25 l’a pris il y a 335 jours, et aucune pull request n’est ouverte. Ouverte
-
FormBuilder with OnChange broke textareaPeut-être à nouveau libre @lane-formio l’a pris il y a 307 jours, et aucune pull request n’est ouverte. Ouverte
-
Difficulté 3/5 1-2 jours Accessibilité débutants 30/100
Toutes les issues de formio/react
Issues similaires
-
bot:ai-assisted component:platform-js status:untriaged
Difficulté 1/5 Moins d'une heure Accessibilité débutants 74/100
midnightntwrk/platform-js#38 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
ranxianglei/billion-context#7068 ·
Les mainteneurs répondent en général sous 1 jour
-
vendor: bump whisper.cpp past 6a8addd — the current pin aborts the app on a failed Metal initOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
mybigday/whisper.rn#348 ·
-
enhancement severity:low
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Battle-Cattle/BCUK-Bot-4#1075 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
ilan-pinto/roaring-lions#1552 ·
Les mainteneurs répondent en général sous 1 jour