# Field validation

**URL:** <https://forum.servoy.com/t/field-validation/9061>\
**Category:** Classic Servoy\
**Created:** [May 3, 2008, 1:42pm UTC](https://forum.servoy.com/t/field-validation/9061 "2008-05-03T13:42:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdotzlaw](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@gdotzlaw](https://forum.servoy.com/u/gdotzlaw)\
**Post date:** [May 3, 2008, 1:42pm UTC](https://forum.servoy.com/t/field-validation/9061/1 "2008-05-03T13:42:02Z")

</div>

I have a field on a layout used for the start time of an event.

The format for field is set to  
elements.start\_time.format = ‘hh:mm a’;

With the new validation in 3.5.3+, no matter what I type in this field, Servoy keeps it red and refuses to let me leave the field.

For example, typing:  
01:00 PM - fails  
01:00 pm - fails  
01:00 p - fails

I’m sure I’m doing something simple wrong, but it eludes me.

Thanks in advance for your help.

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [May 3, 2008, 2:39pm UTC](https://forum.servoy.com/t/field-validation/9061/2 "2008-05-03T14:39:46Z")

</div>

Have you tried to also set the edit mask? What happens if you do

```auto
elements.start_time.format = 'hh:mm a|hh:mm a'; 

```

?

---

<div class="post-metadata">

**Author:** ![gdotzlaw](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@gdotzlaw](https://forum.servoy.com/u/gdotzlaw)\
**Post date:** [May 3, 2008, 2:50pm UTC](https://forum.servoy.com/t/field-validation/9061/3 "2008-05-03T14:50:44Z")

</div>

That also fails.

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [May 3, 2008, 3:18pm UTC](https://forum.servoy.com/t/field-validation/9061/4 "2008-05-03T15:18:24Z")

</div>

And if you set that format directly on the field in design mode? That also fails?

---

<div class="post-metadata">

**Author:** ![Jan\_Aleman](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jan\_Aleman](https://forum.servoy.com/u/Jan_Aleman)\
**Post date:** [May 3, 2008, 3:41pm UTC](https://forum.servoy.com/t/field-validation/9061/5 "2008-05-03T15:41:17Z")

</div>

Works fine for me

Mac  
Java 1.6  
svy 3.5.4

---

<div class="post-metadata">

**Author:** ![gdotzlaw](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@gdotzlaw](https://forum.servoy.com/u/gdotzlaw)\
**Post date:** [May 3, 2008, 4:21pm UTC](https://forum.servoy.com/t/field-validation/9061/6 "2008-05-03T16:21:03Z")

</div>

Not sure I fully understand what was wrong, but this is what I did to correct the problem:

- I followed Patrick’s suggestion and applied the format for the field in Design mode. There was only a selection of date with time, none for time only, but I did it anyway, and found it worked when tested (data could now be changed in the field and validation did not fail)

- I then removed the format for the field in design mode, and set the format using the exact same method again with the format string ‘hh:mm a’ string. Now it works.

Using Servoy 3.5.5 on Windows if that matters.

Glad it is now working. Thanks to all.
