[aida] Show errors

Janko Mivšek janko.mivsek at eranova.si
Wed Oct 17 11:24:47 CEST 2007


Dirk,

Dirk Verleysen wrote:

> what is your experience on showing errors to the user ? Create a special 
> ErrorApp for this ?

You can use a buit-in support in WebApplication. There are 
#error/#error: and #errorReport methods. A simple rule is that if you 
set an error with some text, then an errorReport element will return 
that text in red.

You can put that errorReport element somewhere on your page (usually 
above an entry form) and set error in your action method after 
verification of submitted data, then reload that same view. For example:

viewMain
   self add: self errorReport
   self addInputFieldAspect: #entry of: self observee.
   self addButtonText: 'submit'

actionMain
   self observee isEntryValid ifFalse:
     [self error: 'Entry not valid!'.
     self redirectToView: #main].
   ...

Now always when entry is not valid, an error text in red will be shown 
above entry field and user can try again.

Best regards
Janko

-- 
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si


More information about the Aida mailing list