Comments (3)
@Khizar-Hussian You are looking for conditional select options. That should be in the documentation link that was shared with you. Note that skip logic and conditional selects are not available for configuration via the UI. You need to set up a Ruby script to load it. See the link below for samples: https://github.com/primeroIMS/primero/tree/develop/db/configuration.
In Primero you will want to implement 2 separate fields. For example you may want to have a multiselect violence
field with options values coming from a Primary Violence Type lookup:['physical_violence', 'mental_violence', 'neglect']
. You will then need to define a lookup Secondary Violence Type lookup with values tagged according to the Primary Violence type. Eg:
Lookup.create_or_update!(
unique_id: 'lookup-secondary-violence-type',
name_en: 'Secondary Violence Type',
lookup_values: [
{ id: 'beating', display_text: 'Beating, tags: %w[physical_violence] },
{ id: 'biting', display_text: 'Biting', tags: %w[physical_violence] },
{ id: 'physical_neglect', display_text: 'Physical Neglect', tags: %w[neglect] },
...
]
)
Lastly, you will need to define a violence_secondary
field that displays options based on the `violence field. Something like:
Field.new(
name: 'violence_secondary',
type: 'select_box',
display_name_en: 'Secondary Violence',
option_strings_source: 'lookup lookup-secondary-violence-type',
option_strings_condition: {
'physical_violence' => { 'eq' => { 'violence' => 'physical_violence' } },
'mental_violence' => { 'eq' => { 'violence' => 'mental_violence' } },
'neglect' => { 'eq' => { 'violence' => 'neglect' } }
}
from primero.
from primero.
@RobertMacTavish Thank you so much for the response!
Would you also kindly link me to a relevant doc for achieving conditional functionality on dropdowns. The basic idea is to have either
- Successive dropdowns whose fields are dependent on the choice in the previous dropdowns, or
- Have one massive cascading dropdown, there will be main fields and subfields, and selecting a subfield would automatically select the main field.
A very crude representation of what we're trying to achieve is attached as an image to this response. If you could point us in the right direction, that would be great!
from primero.
Related Issues (20)
- Production Docker image documentation HOT 3
- Field Validation on the frontend
- Problem with a preseeded admin account credentials HOT 4
- Docker not start
- Difficulties with installation
- Link on repo description is incorrect HOT 1
- When the cursor is not on the icon then also it is showing the link. HOT 2
- Enhancements in New Tracing Requests HOT 2
- Need fix for "2.6.2-compliant syntax, but you are running 2.6.5" warnings. HOT 1
- About the project architecture and view
- Primero Installation Issue
- Extremely Outdated Production Deployment Procedures and Documentation HOT 3
- Error While Connecting from Android App HOT 4
- Ordering of Forms in side panel on v1.7
- We tried to modify the development but had a problem connecting with public IP and Domain in the VPS
- Installation issue HOT 19
- Determining the case stage at which the user is currently at.
- Automatically show the user which form should be filled next
- Up and Running Doc
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 primero.