Mar 28, 2008 #1 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
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
Mar 28, 2008 1 #2 guitarzan Programmer Apr 22, 2003 2,236 US You can use the FormatNumber() function on the value you read in from the form. http://www.w3schools.com/vbscript/func_formatnumber.asp Upvote 0 Downvote
You can use the FormatNumber() function on the value you read in from the form. http://www.w3schools.com/vbscript/func_formatnumber.asp
Mar 28, 2008 Thread starter #3 Hondy Technical User Mar 3, 2003 864 GB Thanks, thats the one! Upvote 0 Downvote
Apr 2, 2008 Thread starter #4 Hondy Technical User Mar 3, 2003 864 GB 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 Upvote 0 Downvote
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
Apr 2, 2008 Thread starter #5 Hondy Technical User Mar 3, 2003 864 GB ah fixed it (mydecimalnumber is a string) mydecimalnumber = formatnumber (mydecimalnumber) Upvote 0 Downvote
Apr 2, 2008 #6 guitarzan Programmer Apr 22, 2003 2,236 US Actually, mydecimalnumber = FormatNumber(mydecimalnumber, 2) Upvote 0 Downvote