Format a calculated result in FP

  • Thread starter Thread starter Wayne-I-M
  • Start date Start date
W

Wayne-I-M

Hi

Last question today (I promise)
I have a calculation that is placed into a form's text box.
Never done this sort of stuff in FP before so forgive the question please.

How do I format it so that it's 2 decimal places.

So 123.45 not 123.456789
The form is here
http://www.folgarida.co.uk/sec9572/app_p6.asp

The weight converter from imperial to metric.

Thank you

PS. I know it's a mess at the mo - just start working o0n this today :-)
 
Looks like you are asking about using your client side script with a round function (to 2 places)
- See http://www.mediacollege.com/internet/javascript/number/round.html
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


Hi

Last question today (I promise)
I have a calculation that is placed into a form's text box.
Never done this sort of stuff in FP before so forgive the question please.

How do I format it so that it's 2 decimal places.

So 123.45 not 123.456789
The form is here
http://www.folgarida.co.uk/sec9572/app_p6.asp

The weight converter from imperial to metric.

Thank you

PS. I know it's a mess at the mo - just start working o0n this today :-)
 
Hi Stephan

Thanks for getting back to me.
I am getting an error due to me not knowing how to point at the path (I
think) in FP.

I think the erro is here

document.roundform.numberfield.value = newnumber;

I keep getting this is not an Object when I change this.

My page is called app_p6.asp
the field/control I need the rounded number to appear in is called TheKGs

http://www.folgarida.co.uk/sec9572/app_p6.asp

Any ideas would be helpful (maybe I should stick to Access :-)

Thank you


This is the script

<script language="javascript" type="text/javascript">
function roundNumber(rnum, rlength) { // Arguments: number to round, number
of decimal places
var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
document.roundform.numberfield.value = newnumber; // Output the result to
the form field (change for your purposes)
}
</script>
 
In
document.roundform.numberfield.value = newnumber
- roundform must be the name of a form in your document
- numberfield must be the name of a form field in your document
In the script you have at: http://www.folgarida.co.uk/sec9572/app_p6.asp you have
TheKGs.value = newnumber
try
document.FrontPage_Form1.TheKGs.value = newnumber

If the form name or field name changes, change the above accordingly

See http://www.w3schools.com/js/default.asp
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


Hi Stephan

Thanks for getting back to me.
I am getting an error due to me not knowing how to point at the path (I
think) in FP.

I think the erro is here

document.roundform.numberfield.value = newnumber;

I keep getting this is not an Object when I change this.

My page is called app_p6.asp
the field/control I need the rounded number to appear in is called TheKGs

http://www.folgarida.co.uk/sec9572/app_p6.asp

Any ideas would be helpful (maybe I should stick to Access :-)

Thank you


This is the script

<script language="javascript" type="text/javascript">
function roundNumber(rnum, rlength) { // Arguments: number to round, number
of decimal places
var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
document.roundform.numberfield.value = newnumber; // Output the result to
the form field (change for your purposes)
}
</script>



--
Wayne
Manchester, England.



Stefan B Rusynko said:
Looks like you are asking about using your client side script with a round function (to 2 places)
- See http://www.mediacollege.com/internet/javascript/number/round.html
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


Hi

Last question today (I promise)
I have a calculation that is placed into a form's text box.
Never done this sort of stuff in FP before so forgive the question please.

How do I format it so that it's 2 decimal places.

So 123.45 not 123.456789
The form is here
http://www.folgarida.co.uk/sec9572/app_p6.asp

The weight converter from imperial to metric.

Thank you

PS. I know it's a mess at the mo - just start working o0n this today :-)
 
Back
Top