-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I Need to create a field where is to be inserted a number (integer or double), with an acronym ago (H or D). What is the best way to implement this, requiring this formatting?
Best Regards,
Helena.
Hi Helena,
Did you mean when user insert number like 1234, it should generate H1234 or D1234?
Hello,
Sorry for my bad English, but no.
I want the user to enter a number 1234D or 1234H, 25D or 25H.
Then I will identify the number that the user entered through D are days and hours are by M. I can not put a combobox in this case.
Helena,
It would be better (in my opinion) to create two components in a horizontal layout. First an intbox or longbox, followed by a set of radio buttons for Days, Hours.
In this way, it's much clearer to the data entry person. Of course, if the field value must be stored in your indicated format, you can always concatenate the radio button value to the end of the number.
If you must do it the way you've described, I suggest using a regular expression within a constraint. See constraints
Hi Helena,
Like rdgrimes said, it would be better to separate input fields for your requirement.
And except using regular expression with constraint as rdgrimes suggested, you can also try override allow keys that user can press for intbox or longbox from client side, then parse user input by yourself.
Here is the sample code that I didn't test:
<intbox id="test" > <attribute w:name="doKeyPress_"> function(evt){ if (!this._shallIgnore(evt, "1234567890DH")) this.$doKeyPress_(evt); } </attribute> </intbox>
Asked: 2012-12-18 19:13:12 +0800
Seen: 91 times
Last updated: Dec 28 '12