It's all about the answers!

Ask a question

Defining A Default For A Validated HTML String That Has A Specific Format

Rob Olsen (351041) | asked May 26 '15, 10:21 p.m.

Basically I am trying to force a name input format as follows:

Last Name, First Name MI (if applicable)

So here is my defined Regular Expression:

[A-Z]{1,20}[,][ ][A-Z]{1,20}[ ]{0,1}[A-Z]{0,2}[.]{0,1}

I know its crazy long but I want to force the "," and " " between the first and last names, but allow the person not to enter a middle initial if they do not have one.  If they do enter a middle initial then there needs to be a space after the "first name" and then 1 or 2 characters followed by a ".".

Here's my dilemma:  I am trying to use a "Default Value" of "Not, defined".  Which is a valid entry.  It follows the format above in the Regular Expression and passes the test, but I get an error in the screen when it displays the default value.  Does "Default Value" put something in the HTML string that I cannot see and therefore it fails??  

Rob Olsen commented May 26 '15, 10:28 p.m.

Ok, so I take this back.  I just tested this Regular Expression in RTC Client and it worked.  I incorporate it on one of my Attributes and when I enter a name "Last, First", which is the correct format, I still get the pop-up error that this is the wrong format.  Is my Regular Expression no good?  It works when I test it, but not when I assigned it to an actual attribute (HTML Medium String)

One answer

permanent link
Rob Olsen (351041) | answered May 29 '15, 11:06 a.m.

Thanks to IBM Support, this required using a fuller format which included both upper and lower case!

[a-zA-Z] was needed.  This has been resolved.

Your answer

Register or to post your answer.