Regex / code for validating a page property?

I have a template with 4 page properties, where the user must make a selection as a validation rule.

In the class editor, I put this in the regular expression field: /^.{2,500}$/

And I also put “You must make a selection” in the Validation message field.

In my template, I put:

{{velocity}}

Errors: $context.validationStatus.errors

{{html wiki=“true”}}

#set ($discard = $doc.use(‘myAppWithinMinutesClass’))
(% class=“xform” %)
(((

: $doc.display(‘myField’) #and so on

If I create a new page and fail to put something in the myField page property, it simply hangs and doesn’t display anything.

However, if I DO make a selection, it will save fine… and then if I go back into edit mode and delete my selection and try to save, THEN the validation works properly.

What could I be doing wrong?

It looks like https://jira.xwiki.org/browse/XWIKI-14552 .