Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Form posting 2 decimal places 1

Status
Not open for further replies.

Hondy

Technical User
Mar 3, 2003
864
GB
Hi

I have a form that submits a number, how can I make sure that the user enters number that is 2 decimal places long?

if they enter 1.5 it should come through automatically as 1.50 rather than tell them to put a 0 on the end.

Thanks
 
Um, have tried it but I don't know how to apply it. I mean I know the syntax but I don't know how to apply it

do I apply it on the form variable or the string?

e.g.
on the form
<input name="form_number" value= "" type="text" size="4" maxlength="4" />

or in the code
mydecimalnumber = Request.Querystring("form_number")

Where and how do I put the format number?

Cheers
 

ah fixed it :) (mydecimalnumber is a string)


mydecimalnumber = formatnumber (mydecimalnumber)
 
Actually,

mydecimalnumber = FormatNumber(mydecimalnumber, 2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top