Project

General

Profile

Feature #99384

Updated by Sybille Peters over 1 year ago

In TCA it is possible to make forms disappear based on some conditions (displayCond). The conditions can be based on the state of other fields. 

 For this to work, you have to add a "reload" to the field it depends on so that the form will be saved and reloaded.  

 Suggested alternative would be to do this behaviour in JavaScript in the core so the form is dynamically displayed. I assume this is not easily done. 

 h2. Example use case 

 Imagine the following 

 Select list or checkbox with several available options: 

 Show 

 - Name 
 - Avatar 
 - Email 
 - Courses 
 - Publications 
 - Thesis topics 
 - ... 

 For some of these options, additional configuration is available. Now you have these options: 

 1. use displayCond and reload for the "Show" field. Which means a dialog will appear on every change asking if we should continue, even for the selections where it is not relevant 
 2. Just show all the fields which clutters the user interface with unused options. Not good 
 3. Write the code yourself in JavaScript which is extra work and makes the extensions very difficult to maintain. For example if you change the field type you have to adapt the JavaScript code.  
 4. Other solutions??? 

  

 I have used 3 now in one use case where 1 and 2 is not feasible. To make this more generic would be quite difficult, but I think not impossible. So the displayCond would be done via JavaScript in the core.  


 h2. Videos 

 This is an example for the "classic" solution with "reload" and "displayCond": For every change, a dialog pops up, must be confirmed, the form is saved and reloaded. Depending on how fast your system is, this may take 1, 2 seconds to reload. If someone works all day as editor, this can be very annoying and impact productivity. 

 !tca_display_cond_classic.gif! 

 -------- 


 This is an example it looks with the JavaScript solution. There is no reload for every change and the transition is smoother. 


 !tca_displaycond_javascript.gif! 


Back