Fixed width for Oxygen Text Box!

mu258770
Posts: 122
Joined: Mon Aug 18, 2014 4:11 pm

Fixed width for Oxygen Text Box!

Post by mu258770 » Mon Mar 04, 2019 10:34 am

Hi,

We are using Oxygen Author 19.1 Eclipse version. For the <day> element inside <bookmap>, we have defined the text box like below,

Code: Select all

bookevent completed day{
-oxy-editable:true;
visibility:-oxy-collapse-text;
content:oxy_textfield(
edit, '#text',
columns, 2)
!important;
}
Here we kept the columns as 2, so that user just enters 2 characters in the text box. But there seems an issue that when user enters more characters, it is getting accepted by the Oxygen. I have gone through oxy_textfield user guide, but I could not find any attribute which make the text box fixed.

We need to make the text box to be fixed to only allow 2 characters in the field. Is it possible using Oxygen CSS?

Regards,
Shabeer

alex_jitianu
Posts: 669
Joined: Wed Nov 16, 2005 11:11 am

Re: Fixed width for Oxygen Text Box!

Post by alex_jitianu » Tue Mar 05, 2019 10:47 am

Hi Shabeer,

Unfortunately, the "columns" property refers only to the size of the form control. It means it will have a width that accommodates two characters. if the user types more, it will not receive any errors.

Currently, the text field form control doesn't have a mechanism to enforce such a behavior, but perhaps we can find some alternatives:
1. If these two characters come from a set of predefined values, you can use a read only combo box form control in which the user can only choose one of the existing values.
2. Through a Schematron rule, you can detect the cases when the user puts more characters and issue a warning. This warning will appear when the user commits the value into the document (in other words, it presses Enter or loses focus)
3. Implement a custom form control that has these checks. You can extend or start from the code of the existing form control to make things easier.

Depending on which path you which to take, I can provide more details about what you should do.

Best regards,
Alex

Post Reply