Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2006, 03:01 PM
Registered User
 
Join Date: Nov 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default HELP!! Numeric Textbox value

HI All. Thanks for the help on my previous question. Can eany one please help me on this one.

I Have three textboxes witch have to be numeric.
I have to take the value of textbox a and b, add them together and get the value in c.
This i can do but the value form a and b dont add up they are displayed in textbox c after each other. can any body help me PLZ.
Here are a example.

set form = document.form
 aa = form.textbox1.value
 ba = form.textbox2.value
 cc = aa + ba

form.textbox3.value = cc
Instead of


 
Old November 7th, 2006, 02:11 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hiii quentinuys!!

Hope this will help you
<script language="vbscript">
sub changeit1()
set form = document.myform
 aa = form.textbox1.value '
 ba = form.textbox2.value '

if isnumeric(aa) and isnumeric(ba) then
form.textbox3.value = cdbl(aa) +cdbl(ba)
end if

end sub
</script>

<form name="myform">
<input type=button value=check onclick="vbscript:changeit1()">
<input type=text name=textbox1>
<input type=text name=textbox2>
<input type=text name=textbox3>
</form>

Cheers :)

vinod
 
Old December 12th, 2006, 05:45 AM
Registered User
 
Join Date: Dec 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am designing a custom Outlook form and as part of my validation (using vbscript) I have certain fields which can only be numeric:

Amount01, Amount02, Amount03, Amount04, Amount05 and TotalAmount (which is read only and adds to total of Amount01-5).
- TotalAmount has a calculation in it's field property which is [Amount01] +[Amount02] etc etc

However as part of validation testing, when I put in text into either of the Amount0(#) fields, it doesn't return an error for the IsNotNumeric function. Hence I have had to change the properties of these fields to text from number, and now get an error message as desired when a letter is typed in.

Unfortunately now, instead of adding the Total of Amount01-5 together, it adds them one after the other in Total Amount. So what should be 2+2+2+2+2 = 10 in Total Amount, is now 22,222.

 
Old December 18th, 2006, 08:04 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

view
http://p2p.wrox.com/topic.asp?TOPIC_ID=53512

surendran
(Anything is Possible)
http://ssuren.spaces.msn.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
numeric only textbox Hughesie78 Classic ASP Basics 7 December 5th, 2007 10:58 AM
From numeric to alfa numeric ebekir XSLT 1 August 10th, 2007 06:13 AM
Adding Numeric TextBox Values virajoza HTML Code Clinic 1 December 18th, 2006 07:59 AM
numeric format for a textbox Rudner Beginning VB 6 1 November 9th, 2004 02:29 PM
Masked TextBox & formatting TextBox melvik C# 1 September 22nd, 2003 11:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.