Validation of datepicker value and whitespace characters...

E

educos

Hi,

I meet a global problem in my infopath form in validation rules. I can easy
reproduce this problem with date picker.

If I put a date picker control in a form, I can tape in some space
characters in the text field and when I loose focus, infopath give me back a
validation error (because there is a "not empty value" that does not meet a
date form). If I click again in the text field, I do not see the spaces
because for some strange behaviour, infopath removes unwanted spaces....but
the spaces are stil present in the XML representation, so the user may not
understand why there is an error.

The same thing happen in normal text field if use the validation rule "field
is not empty". This rule become true if user inpu some space characters in
the field...but for me the value is still empty...

So, my question: is there an easy way to avoid this behavior...

Best regards.

Eric.
 
C

Clay Fox

You could add a conditional rule or to that after change the field was spaces
that it would set it to empty string or a default or something. You could
check if it was a valid date format, yyyy-mm-dd or whatever and if it was not
then reset the field.
 
E

educos

Hi Clay,

I already had such an idea. If I had only one or two such fields, that would
be no problem....but the form I work on has more than 40 fields with cross
validation rules...

Another situation that I met is the following:
I have two fields (txtField1 and txtField2) and I have put a validation rule
so that when the user put something in one of the two fields, he must put
something in the other field. To do that, I defined a "validation rule" on
each field with such condition:
- txtField1 is empty AND txtField2 is not empty on txtField1
- txtField2 is empty AND txtField1 is not empty on txtField2
but now, if user put a space character in txtField1, the txtField2 is
marqued as an error (with a red star) and yet txtField1 is empty (for the
user point of view).

I think there is a bug of incoherence between the data stored in XML and
data displayed in the form. If a field is displayed "blank", the value of the
field in XML should be considered as empty...here is not the case.

Regards.

Eric.
 
C

Clay Fox

Hey Eric.

Yah validation is a pain.

Sounds like these users like their space bar.

Some times you can create a hash type field.

Say for your 40 dates, have one field that concatenates them all into one
string.
Then use a contains to check for any spaces. If the field is blank it will
be skipped but if it has space that would get concatenated in and you could
detect it. Unfortunately you cannot say which field but you can block the
user until they get their dates cleaned up.
This probably would not work on your text fields, for those I would check
them for a space and then reset them to empty.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top