Hi, I need a form with two tabs (US & Metric). Each form has two radio buttons, a picklist and two free text fields to hold numbers. And a 'calculate' button on each form. The calculation takes the option chosen in the radio button (male/female) and the option chosen in the picklist to apply a constant to the two numbers and produce a result eg
If option = 'male' and picklist = 'moderate' then constant = 5. If value a = 10 and value b = 2 then the calculation = 5 * 2 * 10/2 for a result of 50
Some error checking is necessary to check for valid numbers in the two free text fields and the range is valid ie between 5 and 50
Hi, Apologies if I'm on the wrong site but I have nothing so far. This is beyond my javascript skills although if I had the basic stucture I'm sure I would be able to flesh it out. As an alternative I am happy to pay for this code so if you can point me at a good javascript programming resource I would be grateful
If you want to try youself, see how close this NON-WORKING setup fulfills your needs.
If OK, then next step would be to add some WORKING javascirpt to perform the calculations.
Thanks for your quick reply. Yes I know enough HTML and CSS to be dangerous so should be able to add some functionality, although I want to hide the calculations from the user. Is this done in the CSS?
Hiding the calculations is not a problem.
Most of the actions don't need to be displayed, so probably will not need CSS for the calculation portion.
You will need to fill-in the labels and picks (etc.) in the script I provided unless you want to design something different.
You will also need to define what the calculation formulas are to be followed with what information.
Sort of what you did in your first post.
Many thanks, for this. I've been trying to build 'function calculate()' for the button onclick="calculate() however not having much luck. I can get the following to work with the value of the text boxes but calling the radio button is proving a little difficult. Here is my pseudo code:
if RBtn0.value = 0 then 10 * SBox0.value + (entry00.value * entry01.value)
elseif RBtn0.value = 1 then 5 * SBox0.value + (entry00.value * entry01.value)
Hi there, I've added the code I need to the calculate function to illustrate what I am trying to do. The calculation changes depending on which radio button is selected. But the problem is calling the radio button. I have got it working without the radio button
Also the code needs to cope with a user selecting the 'Metric' tab
You're a legend! Many thanks to you and the others who have stuck with me on this journey.
I would also like to hide the calculate function on another page and link to it from this page in order to hide the calculation from a 'view source'. Is this possible or practical?
...
I would also like to hide the calculate function on another page and link to it from this page in order to hide the calculation from a 'view source'. Is this possible or practical?
...
What do you mean by 'hide the calculate function'?
Do you mean hide the code that does the calculation?
If yes, then forget it. You cannot hide JS code from view.
Bookmarks