Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
Posts: 2
Registered: ‎03-31-2010
My Device: Bold 9700
My Carrier: n/a

input type=number & javascript onblur

I have a javascript function that adds (###) ###-#### formatting.  However, it only works for the input command when type=text, not number.

 <form id="test1">

<input id="phone1" type="number" onblur="formatPhoneText(this)"

<input id="phone2" type="text" onblur="formatPhoneText(this)"

 </form>

 

Any help is appreciated.

Thanks

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: input type=number & javascript onblur

If you can post the version of the BlackBerry Operating System where you are encountering the problem it be greatly appreciated. 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Contributor
Posts: 2
Registered: ‎03-31-2010
My Device: Bold 9700
My Carrier: n/a

Re: input type=number & javascript onblur

v5.0.0.321 (platform 5.1.0.90)

Highlighted
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: input type=number & javascript onblur

Hi matts5,

 

One of our developers uncovered what is likely going on.  When you have an input box with its type set to number, such as in your previous example:

 

 

<input id="phone1" type="number" onblur="formatPhoneText(this)"/>

 

 

If you try and set the value via JavaScript with characters and not purely an number value, it simply ignores the request to set the value.

 

If you are wanting to set the value with text characters in your formatting you need to make sure that the input type is text.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter