Re: field format checker in issue editor ...

Johannes Höchstädter <[email protected]> Wed, 23 Sep 2009 12:38:57 +0200
Newsgroups gmane.comp.java.scarab.devel
Message-ID <[email protected]>
Hi,

I would appreciate this feature, having optional constraints (regex=20
patterns), for some types of attributes.

I like the second idea you had, by applying the optional regexp pattern=20
as an additional filed for every attribute, best.

cheers

Hussayn Dabbous schrieb:
> Hi;
>
> I have implemented a small add on feature to Scarab. A field checker base=
d
> on regular
> expressions. I originaly wanted to use intake for this purpose, but i cou=
ld
> not find out,
> how to define dynamic rules with intake. so i modified ReportIssue.java a=
nd
> ModifyIssue.java
> instead. The concept is easy:
>
> When you define a new attribute, you now can define an associated regular
> expression,
> which is used to check the field input for validity. If the format field =
is
> kept empty in the attribute
> definition, then no field checking is done during issue
> creation/modification. Of course the regex=20
> is stored in the database along with the attribute.
>
> Now there is one little caveat with this :
>
> When a user enters a wrong value, an error message is generated "invalid
> pattern used for field xxx"
> and the regular expression is shown. Now this is good for developers, but
> bad for customers.
> Customers seem to not know about regular expressions. for instance:
>
>     invalid value in field "daytime": "12.20". expected format is
> "\d\d?:\d\d?"
>
> Now it would be much more convenient to see something like this:
>
>     invalid value in field "daytime": "12.20". expected format is "nn:nn"
>
> which more people tend to understand immediately.
>
>
> So i think about adding yet another field to the Attribute definition,
> namely "patternHint" with a human  readable representation of whichever
> format is expected.  And as another goodie this value could be used as
> default value for the field:
>
> Lets assume, the "patternHint" would be set to "nn:nn". Now Scarab uses t=
his
> value as default in the daytime field and if the user does not change the
> value, scarab will complain:
>
>     invalid value in field "daytime": "nn:nn". expected format is "nn:nn"
>
> Now i could derive from the fact, that the value is invalid AND it is equ=
al
> to the default value, that
> the correct error message would be:
>
>    Please type a valid value into the field "daytime" and use the given
> format "nn:nn"
>
> All this can be done with Scarab and very little logic. Do you think this=
 is
> a good idea or does it feel
> more like a hack ?
>
> When i started this feature, i also thought it might be a good idea to
> invent a new fieldType "daytime" but i quickly decided, that such an
> implementation is not flexible enough. So i ended with the regex
> implementation, which could be used in many other circumstances too.
>
> otoh having a daytime widget like the calendar would be something valuabl=
e
> in itself ...
>
> comments appreciated.
>
> regards, hussayn
>  =20

--=20

Johannes H=C3=B6chst=C3=A4dter

memoComp Software Engineering & Consulting
Frank Freund
Michelsberg 28
65183 Wiesbaden
Germany
Fon +49 (0)611 9320054
Fax +49 (0)611 9320059
Amtsgericht Wiesbaden HRA 4304

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3D455&dsMessageId=3D23=
98818

To unsubscribe from this discussion, e-mail: [[email protected]=
.org].