Error on Text Boxes

H

Hazel

Hi

First post here wonder if you can help with the problem on this form
<FORM>

<INPUT TYPE="BUTTON" VALUE="=" onClick="form.T16.value =
((((form.T16.value = form.T12 * form.T14(form.T16.value)))))">
<INPUT TYPE="TEXT" NAME="Total Value">
</FORM>

On Click T16 displays NaN -- Lost it here I'm afraid -- Help
 
R

Ronx

I am assuming that T12, T14 and T16 are text boxes that are not included in
your code snippet. Also assuming that the form is the first form on the
page in Code view. If this is the case then:

<body>
<form>
<script type="text/javascript">
function calculate() {
var df = document.forms[0]
if (!isNaN(df.T12.value)) { //check that a numeric value is entered
if (!isNaN(df.T14.value)) {
df.T16.value = df.T12.value * df.T14.value;
return;
}}
df.T16.value = "Numeric values required"; //error message
}
</script>

<input name="T14" type="text"><br />
<input name="T12" type="text"><br />

<input type="button" value="=" onclick="calculate()"> <br />
<input name="T16" type="text">
</form>
</body>

The above makes a lot of assumptions which may not be accurate - I have no
idea what your code is supposed to do since the onClick function makes no
sense to me, and the relevant form fields are missing.
--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.
 
H

Hazel

Hi & Good Morning

Thanks for the reply and I do apologise in delayed answering my company had
me all over the place yesterday and this morning I have over a 100 mile
commute.

I set up a new page and got all of your reply working then I had a go at
changing it to fit my requirements still OK until I wanted to Add the values
of the two textboxes
T16 / T17 instead of adding them it is multiplying them together and a
couple of early morning hours trying has not helped at all.


<script type="text/javascript">
function calculate() {
var df = document.forms[0]
if (!isNaN(df.T12.value)) { //check that a numeric value is entered
if (!isNaN(df.T14.value)) {
if (!isNaN(df.T13.value)) { //check that a numeric value is entered
if (!isNaN(df.T15.value)) {
if (!isNaN(df.T16.value)) {
if (!isNaN(df.T17.value)) {
if (!isNaN(df.T18.value)) {


df.T16.value = df.T12.value * df.T14.value;
df.T17.value = df.T13.value * df.T15.value;
df.T18.value = df.T16.value + df.T17.value;
return;
}}}}}}}
df.T16.value = "Numeric values required"; //error message
df.T17.value = "Numeric values required"; //error message
df.T18.value = "Numeric values required"; //error message

}
</script>

<input name="T14" type="text" size="6"><br />
<input name="T12"value=" 7.00" type="text" size="6"><br />
<input name="T13" type="text" size="6"><br />
<input name="T15"value=" 3.50" type="text" size="6"><br />

<br />
<input name="T16" type="text" size="6">
</p>
<input name="T17" type="text" size="6"></p>
<input name="T18" type="text" size="6"><p>
<input type="button" value="Add / Multiply" onclick="calculate()"></p>
<p>
</p>


</form>

</body>




</html>

--
Many Thanks


Ronx said:
I am assuming that T12, T14 and T16 are text boxes that are not included in
your code snippet. Also assuming that the form is the first form on the
page in Code view. If this is the case then:

<body>
<form>
<script type="text/javascript">
function calculate() {
var df = document.forms[0]
if (!isNaN(df.T12.value)) { //check that a numeric value is entered
if (!isNaN(df.T14.value)) {
df.T16.value = df.T12.value * df.T14.value;
return;
}}
df.T16.value = "Numeric values required"; //error message
}
</script>

<input name="T14" type="text"><br />
<input name="T12" type="text"><br />

<input type="button" value="=" onclick="calculate()"> <br />
<input name="T16" type="text">
</form>
</body>

The above makes a lot of assumptions which may not be accurate - I have no
idea what your code is supposed to do since the onClick function makes no
sense to me, and the relevant form fields are missing.
--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.



Hazel said:
Hi

First post here wonder if you can help with the problem on this form
<FORM>

<INPUT TYPE="BUTTON" VALUE="=" onClick="form.T16.value =
((((form.T16.value = form.T12 * form.T14(form.T16.value)))))">
<INPUT TYPE="TEXT" NAME="Total Value">
</FORM>

On Click T16 displays NaN -- Lost it here I'm afraid -- Help
 
R

Ronx

<body>
<form>
<script type="text/javascript">
function calculate() {
vary df = document.forms[0]
if (!isNaN(df.T12.value)) { //check that a numeric value is entered
if (!isNaN(df.T14.value)) {
if (!isNaN(df.T13.value)) { //check that a numeric value is entered
if (!isNaN(df.T15.value)) {
//no need to check T16,T17 or T18 since they are calculated

df.T16.value = df.T12.value * df.T14.value;
df.T17.value = df.T13.value * df.T15.value;
df.T18.value = (df.T12.value * df.T14.value) + (df.T13.value * df.T15.value)
return;
}}}}
df.T16.value = "Numeric values required"; //error message
df.T17.value = "Numeric values required"; //error message
df.T18.value = "Numeric values required"; //error message

}
</script>
<p>
<input name="T14" type="text" size="6"><br />
<input name="T12"value="7.00" type="text" size="6"><br />
<input name="T13" type="text" size="6"><br />
<input name="T15"value="3.50" type="text" size="6"><br />
</p>
<p><input type="button" value="Add / Multiply" onclick="calculate()"></p>

<p><input name="T16" type="text" size="6"></p>
<p><input name="T17" type="text" size="6"></p>
<p><input name="T18" type="text" size="6"><p>
</form>

</body>


Your version is not multiplying the results - it's concatenating them. For
example, it is saying that 2 +2 = 22.
--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.



Hazel said:
Hi & Good Morning

Thanks for the reply and I do apologise in delayed answering my company
had
me all over the place yesterday and this morning I have over a 100 mile
commute.

I set up a new page and got all of your reply working then I had a go at
changing it to fit my requirements still OK until I wanted to Add the
values
of the two textboxes
T16 / T17 instead of adding them it is multiplying them together and a
couple of early morning hours trying has not helped at all.


<script type="text/javascript">
function calculate() {
var df = document.forms[0]
if (!isNaN(df.T12.value)) { //check that a numeric value is entered
if (!isNaN(df.T14.value)) {
if (!isNaN(df.T13.value)) { //check that a numeric value is entered
if (!isNaN(df.T15.value)) {
if (!isNaN(df.T16.value)) {
if (!isNaN(df.T17.value)) {
if (!isNaN(df.T18.value)) {


df.T16.value = df.T12.value * df.T14.value;
df.T17.value = df.T13.value * df.T15.value;
df.T18.value = df.T16.value + df.T17.value;
return;
}}}}}}}
df.T16.value = "Numeric values required"; //error message
df.T17.value = "Numeric values required"; //error message
df.T18.value = "Numeric values required"; //error message

}
</script>

<input name="T14" type="text" size="6"><br />
<input name="T12"value=" 7.00" type="text" size="6"><br />
<input name="T13" type="text" size="6"><br />
<input name="T15"value=" 3.50" type="text" size="6"><br />

<br />
<input name="T16" type="text" size="6">
</p>
<input name="T17" type="text" size="6"></p>
<input name="T18" type="text" size="6"><p>
<input type="button" value="Add / Multiply" onclick="calculate()"></p>
<p>
</p>


</form>

</body>




</html>

--
Many Thanks


Ronx said:
I am assuming that T12, T14 and T16 are text boxes that are not included
in
your code snippet. Also assuming that the form is the first form on the
page in Code view. If this is the case then:

<body>
<form>
<script type="text/javascript">
function calculate() {
var df = document.forms[0]
if (!isNaN(df.T12.value)) { //check that a numeric value is entered
if (!isNaN(df.T14.value)) {
df.T16.value = df.T12.value * df.T14.value;
return;
}}
df.T16.value = "Numeric values required"; //error message
}
</script>

<input name="T14" type="text"><br />
<input name="T12" type="text"><br />

<input type="button" value="=" onclick="calculate()"> <br />
<input name="T16" type="text">
</form>
</body>

The above makes a lot of assumptions which may not be accurate - I have
no
idea what your code is supposed to do since the onClick function makes no
sense to me, and the relevant form fields are missing.
--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.



Hazel said:
Hi

First post here wonder if you can help with the problem on this form
<FORM>

<INPUT TYPE="BUTTON" VALUE="=" onClick="form.T16.value =
((((form.T16.value = form.T12 * form.T14(form.T16.value)))))">
<INPUT TYPE="TEXT" NAME="Total Value">
</FORM>

On Click T16 displays NaN -- Lost it here I'm afraid -- Help
 
H

Hazel

Hi

Thank you for all your help it is all working OK now -- there are lots of
things I would love to do with my little form to improve its presentation
i.e. formatting the currency in the relevant boxes and then emailing it as an
invoice to the correct person however I will keep looking and hopefully find
the answers.
--
Many Thanks


Ronx said:
<body>
<form>
<script type="text/javascript">
function calculate() {
vary df = document.forms[0]
if (!isNaN(df.T12.value)) { //check that a numeric value is entered
if (!isNaN(df.T14.value)) {
if (!isNaN(df.T13.value)) { //check that a numeric value is entered
if (!isNaN(df.T15.value)) {
//no need to check T16,T17 or T18 since they are calculated

df.T16.value = df.T12.value * df.T14.value;
df.T17.value = df.T13.value * df.T15.value;
df.T18.value = (df.T12.value * df.T14.value) + (df.T13.value * df.T15.value)
return;
}}}}
df.T16.value = "Numeric values required"; //error message
df.T17.value = "Numeric values required"; //error message
df.T18.value = "Numeric values required"; //error message

}
</script>
<p>
<input name="T14" type="text" size="6"><br />
<input name="T12"value="7.00" type="text" size="6"><br />
<input name="T13" type="text" size="6"><br />
<input name="T15"value="3.50" type="text" size="6"><br />
</p>
<p><input type="button" value="Add / Multiply" onclick="calculate()"></p>

<p><input name="T16" type="text" size="6"></p>
<p><input name="T17" type="text" size="6"></p>
<p><input name="T18" type="text" size="6"><p>
</form>

</body>


Your version is not multiplying the results - it's concatenating them. For
example, it is saying that 2 +2 = 22.
--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.



Hazel said:
Hi & Good Morning

Thanks for the reply and I do apologise in delayed answering my company
had
me all over the place yesterday and this morning I have over a 100 mile
commute.

I set up a new page and got all of your reply working then I had a go at
changing it to fit my requirements still OK until I wanted to Add the
values
of the two textboxes
T16 / T17 instead of adding them it is multiplying them together and a
couple of early morning hours trying has not helped at all.


<script type="text/javascript">
function calculate() {
var df = document.forms[0]
if (!isNaN(df.T12.value)) { //check that a numeric value is entered
if (!isNaN(df.T14.value)) {
if (!isNaN(df.T13.value)) { //check that a numeric value is entered
if (!isNaN(df.T15.value)) {
if (!isNaN(df.T16.value)) {
if (!isNaN(df.T17.value)) {
if (!isNaN(df.T18.value)) {


df.T16.value = df.T12.value * df.T14.value;
df.T17.value = df.T13.value * df.T15.value;
df.T18.value = df.T16.value + df.T17.value;
return;
}}}}}}}
df.T16.value = "Numeric values required"; //error message
df.T17.value = "Numeric values required"; //error message
df.T18.value = "Numeric values required"; //error message

}
</script>

<input name="T14" type="text" size="6"><br />
<input name="T12"value=" 7.00" type="text" size="6"><br />
<input name="T13" type="text" size="6"><br />
<input name="T15"value=" 3.50" type="text" size="6"><br />

<br />
<input name="T16" type="text" size="6">
</p>
<input name="T17" type="text" size="6"></p>
<input name="T18" type="text" size="6"><p>
<input type="button" value="Add / Multiply" onclick="calculate()"></p>
<p>
</p>


</form>

</body>




</html>

--
Many Thanks


Ronx said:
I am assuming that T12, T14 and T16 are text boxes that are not included
in
your code snippet. Also assuming that the form is the first form on the
page in Code view. If this is the case then:

<body>
<form>
<script type="text/javascript">
function calculate() {
var df = document.forms[0]
if (!isNaN(df.T12.value)) { //check that a numeric value is entered
if (!isNaN(df.T14.value)) {
df.T16.value = df.T12.value * df.T14.value;
return;
}}
df.T16.value = "Numeric values required"; //error message
}
</script>

<input name="T14" type="text"><br />
<input name="T12" type="text"><br />

<input type="button" value="=" onclick="calculate()"> <br />
<input name="T16" type="text">
</form>
</body>

The above makes a lot of assumptions which may not be accurate - I have
no
idea what your code is supposed to do since the onClick function makes no
sense to me, and the relevant form fields are missing.
--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.



Hi

First post here wonder if you can help with the problem on this form
<FORM>

<INPUT TYPE="BUTTON" VALUE="=" onClick="form.T16.value =
((((form.T16.value = form.T12 * form.T14(form.T16.value)))))">
<INPUT TYPE="TEXT" NAME="Total Value">
</FORM>

On Click T16 displays NaN -- Lost it here I'm afraid -- Help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top