Ticket #268 (new enhancement)

Opened 2 months ago

Last modified 2 months ago

Option to use html tags as validation message instead of only plain text.

Reported by: svr Assigned to: mpo
Priority: minor Milestone: 0.4
Component: modules/kauri-forms Version: trunk
Keywords: validation html text validators Cc:

Description

It would be nice to have an option to use html as a validation 'message'. To show an image for example instead of text-only.

At the moment you can force it with doing to following:

'+validators': {'required' : { message: "<img src=\"/static/images/warning.png\" alt=\"Veld is verplicht\" title=\"Veld is verplicht\"/>" }}

But it's not ideal when you want to use a more complex html structure

Change History

20/01/10 15:26:54 changed by mpo

Hi,

Upon brief code-checking I noticed the html formatting is supported (in fact that is what your sample is using)

Could you elaborate what 'other' behaviour you'ld like to precisely see?

On the side I would recommend

  1. using css effects on the class 'invalid' for popping up warning.png images around fields not being valid...
  2. nesting ' inside " to avoid escaping \"

21/01/10 10:54:18 changed by svr

Hello,

I tried the stuff you suggested but:

1. 'invalid' class is on the input field only, not on the 'span' container for the messages.

2. is an option and works but I try to avoid html tags in the javascript as much as possible

It would be easier if I would have an extra option at my disposal like for example:

'+validators': {
    'required' : { 
        image: {
            url: '/static/images/warning.png',
            alt: 'Field is required!',
            title: 'Required field'
        }
    }
}