Adding custom field displays "Invalid value for field&q

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
jvcoder

Adding custom field displays "Invalid value for field&q

Post by jvcoder »

I added a custom field (Company Name) and made the type STRING. When I go to add text into the field and submit I get [APPLICATION ERROR #1303 Invalid value for field].

Can someone please explain why I am entering an invalid field when I'm entering a text string?

thank you
thraxisp
Developer
Posts: 509
Joined: 14 Feb 2005, 03:38
Location: Ottawa, Canada
Contact:

Post by thraxisp »

The value could be too short or too long, or not match the regular expression provided.
Guest

Same problem

Post by Guest »

I have the same problem, but only when i left the user defined field blank. In the definition the field id not required, but with Regular expression enabled, i can not leave the field blank.
The expression i use is: (A|B[0-9]{9})|([0-9]{10}). The expression catches the right values, but not the blank field!

Any help apreciated!

Many regards,
Christoph Neyen
Jee
Posts: 5
Joined: 22 May 2006, 09:54

Post by Jee »

thraxisp wrote:The value could be too short or too long, or not match the regular expression provided.
Hi,
I have imposed a regular expression validation on a custom field and that works perfectly. Is there a way though to customize the "APPLICATION ERROR #1303 Invalid value for field" error message?
Often reporters don't have a clue which field is wrong. I would like to have a custom message but knowing which field is wrong would already be helpful.

Jee
Narcissus
Developer
Posts: 338
Joined: 17 Feb 2005, 09:45

Post by Narcissus »

Christoph:

I believe the problem you're experiencing is the fact that although the field is not required, your regular expression does not allow for an empty string.

I can see the argument for this going both ways but you could always bug it. For the time being, fix your regular expression to also allow an empty string.

Jee: to my knowledge, you cannot make the message any less generic without some code hacking.

Hope this helps,
Lincoln.
Jee
Posts: 5
Joined: 22 May 2006, 09:54

Post by Jee »

Narcissus wrote:Jee: to my knowledge, you cannot make the message any less generic without some code hacking.
Thanks Lincoln. Any hints as to where in the code I should be hacking? I've done some searching but couldn't find an obvious place to insert my coding.

Thanks in advance,

Jee
ANR Daemon
Posts: 5
Joined: 09 Aug 2006, 22:53

Re: Same problem

Post by ANR Daemon »

Anonymous wrote:I have the same problem, but only when i left the user defined field blank. In the definition the field id not required, but with Regular expression enabled, i can not leave the field blank.
The expression i use is: (A|B[0-9]{9})|([0-9]{10}). The expression catches the right values, but not the blank field!

Any help apreciated!

Many regards,
Christoph Neyen
At first, You have 2 errors in Your RE.
1. Technical
When we mean a 10-letter string, (A|B[0-9]{9}) match these strings:

"A"
"B#########"

but not "A#######"

2. Ideological
Your RE match any part of string, but not whole string.
So, (when we mean a 10-char str), Your RE allow "xyhgfAdmiw" string, looks totally wrong for You.

To solve both problems and allow empty string, try this RE:

Code: Select all

^([AaBb0-9][0-9]{9})?$
Post Reply