-
Notifications
You must be signed in to change notification settings - Fork 753
Edit Response results in empty array (that leads to cf-conditional to fail) #421
Copy link
Copy link
Open
Description
On the first flow, the cf-conditonal works normally because tagValue is [''] (array with emtpy string).
However, if the user edit a response, the cf-condition fails to work and always return false because tagValue is now [] (emtpy array).
We are testing for emtpy string with a RegExp cf-conditional for a tag that might be skipped/hidden due to a previous tag.
conversational-form/src/scripts/cf/logic/FlowManager.ts
Lines 281 to 304 in 23016ad
| /** | |
| * @name editTag | |
| * go back in time and edit a tag. | |
| */ | |
| public editTag(tag: ITag): void { | |
| this.ignoreExistingTags = false; | |
| this.savedStep = this.step - 1;//save step | |
| this.step = this.tags.indexOf(tag); // === this.currentTag | |
| this.validateStepAndUpdate(); | |
| if(this.activeConditions && Object.keys(this.activeConditions).length > 0){ | |
| this.savedStep = -1;//don't save step, as we wont return | |
| // clear chatlist. | |
| this.cfReference.chatList.clearFrom(this.step + 1); | |
| //reset from active tag, brute force | |
| const editTagIndex: number = this.tags.indexOf(tag); | |
| for(var i = editTagIndex + 1; i < this.tags.length; i++){ | |
| const tag: ITag | ITagGroup = this.tags[i]; | |
| tag.reset(); | |
| } | |
| } | |
| } |
conversational-form/src/scripts/cf/form-tags/Tag.ts
Lines 248 to 261 in 23016ad
| for (var i = 0; i < condition.conditionals.length; i++) { | |
| var conditional: string | RegExp = condition.conditionals[i]; | |
| if(typeof tagValue !== "string"){ | |
| for (var j = 0; j < tagValue.length; j++) { | |
| isValid = testValue(<string>tagValue[j], conditional); | |
| if(isValid) break; | |
| } | |
| }else{ | |
| // string comparisson | |
| isValid = testValue((<string[]>tagValue).toString(), conditional); | |
| } | |
| if(isValid) break; | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels