forms that intentionally reuse a key with mutually exclusive conditionals
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 64/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- react, typescript
- Domínio
- frontend
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- TypeScript
- Estrelas
- 371
- Forks
- 309
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de formio/react
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
-
onChange `modified` property remains false when file component is updatedTalvez livre de novo @ZenMasterJacob20011 assumiu há 293 dias e não há nenhum pull request aberto. Aberta
-
FormBuilder onChange callback not triggered when options prop is providedTalvez livre de novo @Victoriya25 assumiu há 335 dias e não há nenhum pull request aberto. Aberta
-
FormBuilder with OnChange broke textareaTalvez livre de novo @lane-formio assumiu há 307 dias e não há nenhum pull request aberto. Aberta
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 30/100
Todas as issues de formio/react
Issues semelhantes
-
bot:ai-assisted component:platform-js status:untriaged
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 74/100
midnightntwrk/platform-js#38 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
ranxianglei/billion-context#7068 ·
Mantenedores costumam responder em até 1 dia
-
vendor: bump whisper.cpp past 6a8addd — the current pin aborts the app on a failed Metal initAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
mybigday/whisper.rn#348 ·
-
enhancement severity:low
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Battle-Cattle/BCUK-Bot-4#1075 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
ilan-pinto/roaring-lions#1552 ·
Mantenedores costumam responder em até 1 dia