Environment: IIS and Coldfusion 8.
How do you direct the user to a specific tab if the data (logically) requires you to?
I was assigning students to a competition event, but if the student pool was empty, the user should be taken directly to the "Add Student" tab. The underlying principle: "When possible, minimize the user's keystrokes/mouseclicks."
Since this was a flash form, I searched the
asfusion site, but came away empty. After some frustrating experimentation, I came up with this 2-step solution.. (there may be better ones out there)
- Create a textbox to store the record count ("records")
- Use a regular expression to update the selectedIndex attribute of the CFFORMGROUP for the tabnavigator
<cfformgroup type="tabnavigator" id="tabs" selectedIndex = "{records.text==0?2:0}">
Note: (1) The "type" for the input box ("records") cannot be "hidden". However, if you use CFINPUT, you can change the "visible" attribute to "false" (2) Tab numbering starts at 0. So the second tab will be "1".