What is the best way to hide/show a section based on the val

Posted by Rollbase User on 10-Jan-2013 15:52

I wanted to show/hide a section on View and Edit pages for an object if a particular field (picklist) had a specific value. I've got it working, but want to make sure I did the right thing. 1) Set integration codes for the picklist values 2) Created two Javascript Functions * one for the Edit (form-based) var code = object_type.options[object_type.selectedIndex].getAttribute('code'); if (code=='TOPIC') { var sectionID = rbf_getSectionIdByTitle("Topic Page Specific Info"); rbf_showOrHideSection(sectionID, true); } * another for the View (i.e. RB expression-based) var code = "{!object_type#code}" if (code=="TOPIC") { var sectionID = rbf_getSectionIdByTitle("Topic Page Specific Info"); rbf_showOrHideSection(sectionID, true); } 3) Called the function from the parent field onChange property (located in the Object Properties -> Fields -> Events) with first testing to make sure the f(n) exists, to change the display during editing * if (typeof cus

All Replies

Posted by Admin on 10-Jan-2013 21:40
Tim,



Your approach and your code looks good, I don't see any issues. We'll plan to add such an example [same concept as yours] to the docs. Thanks for the suggestion.



Matt
Posted by Admin on 11-Jan-2013 12:37
Thanks for idea, I added example on Page 28 Chapter 7.
This thread is closed