So, when I'm building an application in Flash and Actionscript 3.0 I create a sharedobject.data and I have an input field, the sharedobject is equal to the input field.But it's only restricted to numbers, but when the input is put in the number is thought to be text.. rather than an actual number (eg. "1" instead of just 1) is there anyway that I can make an input field into something like a number field?
Have you tried:
var variable:Number;
variable= Number(input_txt.text);
Related
I have an input mask of JAAA-AAA on a TextBox, so when the user enters that input field, they will see this: "J___-___".
However, when they fill it out like so, J123-321, and I get the value using [myfield].Value, it says that the value is only 123321. It strips the preset 'J' and '-' I had in there. How can I prevent the stripping of these characters when I retrieve the value from this field?
You need to set the second part of the input mask property to 0.
If you look at the documentation, you can see it has 3 parts, and the 2nd part controls if the mask is stored with the data, or only the data is stored.
The final mask property would be the following:
\JAAA\-AAA;0;_
I'm using standard HTML TextBoxFor helpers in an MVC5 project and wanted to set a textbox to accept numeric values only.
So I've set the type to be number.
#Html.TextBoxFor(model => model.PP_IMP_M1, "{0:0}", new { #type ="number"})
I'm not sure what the functionality of the HTML input type=number is supposed to be but when I type only letters in the textbox and tab out, the textbox clears itself as the value was not numeric. This is expected and correct.
However, if I type the first character as a number and follow this with random letters then the mixed text value remains in the textbox. I know the character 'e' may have been acceptable but I'm entering things like '12hgf' & '45dddd' and the textbox accepts the value after I tab out.
Is this the expected behaviour for an input with type set as number?
I was hoping the type=number would only accept numeric values without me having to use javascript or jquery.
Any help on this issue would be appreciated.
Shuja
How do I format a number with 2 decimal places to a whole number?
I used the Lookup function to get a result, but formatting decimal to whole number does not work for this value. I did Text box properties -> number -> whole number doesn't work for one of my value. Also customize number to #,### but its not changing anything.
How do I make this value display as a whole number?
You may be confusing how the number is displayed (which can be controlled using text box properties) and it's actual value. It sounds like the value returned from the lookup is not a number, it might be a string/text value instead which would explain why it was not affected by number formatting.
One option is to convert the value to an integer (whole number) in the lookup expression itself, using a function to convert the value: CInt()
For example if your expression currently looks something like this:
=Lookup(Fields!SomeField.Value, Fields!SomeDatasetField1.Value, Fields!SomeDatasetField2.Value, "SomeDataset")
then you can change it to:
=CInt(Lookup(Fields!SomeField.Value, Fields!SomeDatasetField1.Value, Fields!SomeDatasetField2.Value, "SomeDataset"))
Or if you want to keep the original value, but just change how it is displayed then convert to a decimal value instead:
=CDec(Lookup(Fields!SomeField.Value, Fields!SomeDatasetField1.Value, Fields!SomeDatasetField2.Value, "SomeDataset"))
and then use the text box formatting options to control the displayed format.
In my Flex application, I have a TextInput box that a user may enter a Number. It comes in as a String, then passes through a NumberFormatter. The result then gets displayed in the TextInput box. This works fine for small numbers.
Large numbers have a problem. For example, if the user enters 100e30 (which is scientific notation for 1x10^32), the TextInput displays:
100000000000000000000000000000000
when what I really want to display is
1.0E32
This is how it appears (and is stored) internally in Flash Builder, for example, as viewed using the debugger.
Is there any simple routine in AS3/mxml that can output scientific notation to a TextInput control?
var n:Number = 10000000000;
trace(n.toExponential(1));
Output :
1.0e+10
To set it to the text input :
textInput.text = n.toExponential(1);
i want to apply masking over the textinput that need to get SSN from user so How apply SSN masking over text input in Flash Builder 4?
The most elegant solution in the long run would be to create a custom component, but it could also be done within an existing TextInput. Give the TextInput a change event that does the following:
var s:String=textInput.text.replace(/[^0-9]/g,"");
textInput.text = s.substring(0,3) +
(s.length>3?"-"+s.substring(3,5)+
(s.length>5?"-"+s.substring(5,9):""):"");
textInput.selectRange(textInput.text.length,textInput.text.length);
This will mask the characters:
txtInput.displayAsPassword = true;
<s:TextInput displayAsPassword="true" restrict="0-9" maxChars="9"/> will cause the text to be shown as asterisks when the user is entering it, and will also prevent them from entering more than 9 characters, or any characters that are not numeric, both of which are requirements of SSNs.