0

Format InputField or Mask?

asked 2012-12-18 19:13:12 +0800

interacthb gravatar image interacthb
78

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.

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2012-12-20 07:51:14 +0800

vincentjian gravatar image vincentjian
2245 6

Hi Helena,
Did you mean when user insert number like 1234, it should generate H1234 or D1234?

link publish delete flag offensive edit

answered 2012-12-27 17:56:40 +0800

interacthb gravatar image interacthb
78

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.

link publish delete flag offensive edit

answered 2012-12-28 01:28:07 +0800

rdgrimes gravatar image rdgrimes
735 7

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

link publish delete flag offensive edit

answered 2012-12-28 08:32:55 +0800

vincentjian gravatar image vincentjian
2245 6

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>

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-12-18 19:13:12 +0800

Seen: 91 times

Last updated: Dec 28 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More