Databinding Errors and the wwWebTabControl

Web Connection's databinding displays error messages on controls that are databound and provides links to those controls on the top of the page. This works great to jump to the control in error, but when that control lives on a tab page that is not visible you'll find that while the control gets activated the tab page won't automatically change to display it.

To work around this issue you can implement a JavaScript function OnBindingErrorLink to intercept link clicks and activate the appropriate page explicitly. Whenever an error link is clicked this global function is called and you can use it to activate the appropriate page. The function receives a single parameter which is the element that has the error on it.

With this knowledge you can use a somewhat generic implementation to activate the appropriate page. The following code assumes that the ID of each tabpage starts with "TabPage" (as in TabPage1, TabPage2 etc.):

function OnBindingErrorLink(control) { // *** Find the parent 'tab' page id while(control) { control = control.parentNode; if (!control) break; if (control.id.substr(0,7) == "TabPage") { ActivateTab("Tabs",control.id); return; } } }

The code walks backward from the control until it finds a the page that matches the "TabPage" id and if found uses that element to activate the tab.


  Last Updated: 7/6/2008 | © West Wind Technologies, 2008