Click to See Complete Forum and Search --> : how to put decimal in ASP


andrewchai
05-04-2005, 09:26 PM
i would like to ask how to set decimal in the text box.
the example are like this.
let say, i have a text box need user to key the digit and the text box will auto display the digit by having the decimal.
if the user key in as 12, and the text box will auto display 12.00
if the user key in as 12.36, and the text box will auto display 12.36
thank you.

buntine
05-04-2005, 09:53 PM
Try the JavaScript forum for automatic formatting.

phpnovice
05-05-2005, 07:27 PM
if the user key in as 12, and the text box will auto display 12.00
If you're talking about receiving the value as "12" from a form submission and being able to display it as "12.00" when you send the value back to the client, then you would use the following for general numbers:

<input type="text" name="myValue"
value="<%=FormatNumber(CDbl(Request.Form("myValue")), 2)%>">

and the following for currency numbers:

<input type="text" name="myValue"
value="<%=FormatCurrency(CDbl(Request.Form("myValue")), 2)%>">