Home > Articles > Web Development

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Error Messages

The final element to add to the logon framework is the ability to present error messages to the user. This is managed by the error-text and error-scrollbox variables as defined in the code listing for the Logon.{create-logon-controls} method in Figure 3–13.

We do not know how large the error message created might be, as it depends on the data returned in the logon XML message. Therefore, to handle an unknown text size, we use the system Curl class ScrollBox. An issue when working with a ScrollBox is that you cannot change its text once it has been instantiated. The ScrollBox would not work in our framework, as we might need to display a different error message each time the user clicks the Login button. To get around this problem, we create a TextFlowBox control and set that within the ScrollBox. With a TextFlowBox, it is simple to change the text set within it, by executing its {add} method and displaying it within the ScrollBox. Vertical and horizontal scrollbars will appear as needed to read the full error text.

  • + Share This
  • 🔖 Save To Your Account