Project

General

Profile

Feature #99384

Updated by Sybille Peters about 1 year ago

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

 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.  

 h3. problems 

 * the dialog asking if one should save and reload is annoying when one is still filling out the fields 
 * in some cases it is unnecessarily displayed (e.g. if some fields are displayed depending on what is seletected in a list and not all changes in the list need the reload) 
 * the field is saved even though the editor is not done 
 * feels clunky and not editor friendly 

 !dialog_refresh_save_cancel.png! 

 h3. Preferred change 

 Suggested alternative would be to do this behaviour in JavaScript in the core so the form is dynamically displayed.  

 h3. Alternatives as developer 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 fields which should be displayed conditionally. "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 to display fields conditionally yourself in JavaScript yourself which is extra work and makes the extensions very difficult to maintain. For example if you change the field type you might 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 with the JavaScript solution. There is no reload for every change and the transition is smoother. 


 !tca_displaycond_javascript.gif! 


Back