Look at this JSValidate demo. That's how I see to make the error
reporting of validations most non-intrussible but informative:
http://www.jsvalidate.com/demo/Go to the first field and just tab out to see, how error will be shown.
Janko
Janko Mivšek wrote:
> Rob Rothwell wrote:
>
>> Also, it would be nice to enhance field validation and error reporting a
>> bit. I'm thinking about ajaxified validation immediately after data
>> entry and immediate error reporting near the field. Non-intrusive and
>> elegant.
>>
>> We can do that by extending WebInputField (WebFormElement?) to include a
>> validation block, which is executed immediately after data entry. We can
>> also provide convenience methods for some most usual validations like
>> date, email, numbers etc.
>
>> I guess that was sort of what I was wondering about after playing around
>> with Magritte in Seaside a bit. It would put the specified error
>> message right there on the form, but was not "ajaxified" (I don't
>> think). It just performed the validation rules upon form entry, with a
>> syntax like:
>>
>> (StringDescription selector: #email label: 'E-Mail Address')
>> addCondition: [ :value |
>> (value matches: '*#@#*.#*')
>> & (value endsWith: '.ch') ] asCondition
>> label: 'Invalid E-Mail';
>> yourself.
>>
>> You would then send a message like "asComponentOn:" to the "Description"
>> of the object to get a Morphic/Seaside component, ready to add to your form.
>>
>> I suppose the Magritte framework could be extended to use Aida objects,
>> if you thought that would be worthwhile. Then you would be describing
>> your domain with "Meta objects" that "knew" how to display themselves in
>> Aida.
>>
>> I don't have enough experience to know if the overhead of a
>> Meta-framework is worth it for most applications, though.
>
> I also have a similar doubt and for now it would be most user friendly
> to extend WebFormElement, so that you'll have a code like:
>
> e addInputFieldAspect: #email
> for: self observee
> validIf: [:value |
> (value matches: '*#@#*.#*') & (value endsWith: '.ch')
> errorText: 'Invalid E-Mail'
>
> Maybe method could be named better...
>
>
> Janko
>
>
--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si_______________________________________________
Aida mailing list
Aida@...
http://lists.aidaweb.si/mailman/listinfo/aida