Comments (2)
When initially setting the value of the first dropdown to A, the second one becomes B. When modifying the second dropdown to either A or B, it works as expected.
You have been created a cyclic dependency, which of course will cause the data to change ad infinitum.
You can define an action with parameters, and then define arguments when linking actions:
![image](https://private-user-images.githubusercontent.com/10303570/344978000-d989b131-4dd5-478b-8ae5-65c556520f3c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIyNjM4NjQsIm5iZiI6MTcyMjI2MzU2NCwicGF0aCI6Ii8xMDMwMzU3MC8zNDQ5NzgwMDAtZDk4OWIxMzEtNGRkNS00NzhiLThhZTUtNjVjNTU2NTIwZjNjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI5VDE0MzI0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJkNjVhYWRjYWY3NmFiN2MwY2JmNjhjMzkwM2IwMGI0YmFhYThlNWEzNWEyY2E3YWEzYWJhZTMxN2ZiNjE3ZDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.oSg0lwqJb6kXBeRI79wvzwMiA-dtxlzAYbj_xa4xjzU)
Example:
{
"version": "1",
"actions": {
"modifyAnotherDropdown": {
"body": " const value = e.args[0]\n if (value === 'a') {\n e.data[args.destKey] = 'b'\n }\n if (value === 'b') {\n e.data[args.destKey] = 'a'\n }",
"params": {
"sourceKey": "string",
"destKey": "string"
}
}
},
"form": {
"key": "Screen",
"type": "Screen",
"props": {},
"children": [
{
"key": "dd1",
"type": "RsDropdown",
"props": {
"value": {
"fnSource": " console.log(\"DD1\", form.data);\n if(form.data.dd2 === \"a\" )\n {\n return \"b\";\n }\n else if (form.data.dd2 === \"b\" )\n {\n return \"a\";\n }\n else \n {\n return form.data.dd1;\n }"
},
"data": {
"value": [
{
"value": "a",
"label": "A"
},
{
"value": "b",
"label": "B"
}
]
}
},
"events": {
"onSelect": [],
"onChange": [
{
"name": "modifyAnotherDropdown",
"type": "code",
"args": {
"sourceKey": "dd1",
"destKey": "dd2"
}
}
]
}
},
{
"key": "dd2",
"type": "RsDropdown",
"props": {
"value": {
"fnSource": " console.log(\"DD2\", form.data);\n\n if(form.data.dd1 === \"a\" )\n {\n return \"b\";\n }\n else if (form.data.dd1 === \"b\" )\n {\n return \"a\";\n }\n else \n {\n return form.data.dd2;\n }\n"
},
"data": {
"value": [
{
"value": "a",
"label": "A"
},
{
"value": "b",
"label": "B"
}
]
},
"readOnly": {
"computeType": "function",
"fnSource": " ",
"value": false
}
},
"events": {
"onChange": [
{
"name": "modifyAnotherDropdown",
"type": "code",
"args": {
"sourceKey": "dd2",
"destKey": "dd1"
}
}
],
"onSelect": []
}
}
]
},
"localization": {},
"languages": [
{
"code": "en",
"dialect": "US",
"name": "English",
"description": "American English",
"bidi": "ltr"
}
],
"defaultLanguage": "en-US"
}
from formengine.
Thank you for the information, I appreciate it greatly
from formengine.
Related Issues (20)
- Customize builder UI HOT 2
- Issue Report: Updating Component Keys in Formengine React Library HOT 1
- Formbuilder clashes in i18n library/ dropdowns seem to render elsewhere HOT 5
- Form Builder (One to one) HOT 4
- Forms Tab is Not available? HOT 1
- Setting "valued" to an object type in a custom component HOT 5
- Crash when RsContainer doesn't exist "props" in the objet HOT 2
- form builder localization HOT 8
- onFormDataChange looping if there is setState inside HOT 5
- cannot add code actions from setting section HOT 14
- general loadCallback function on loadData options HOT 5
- imported lib not loaded HOT 2
- Getting error with Monaco editor in Electron application HOT 7
- No option to duplicate rows above HOT 1
- CSS not loading in FormViewer HOT 3
- Data Payload not structured HOT 3
- Update breaks build when using rollup HOT 3
- Possible to write the value to other form control by action? HOT 1
- Error: Download JSON #2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formengine.