Home > Net >  How do you place the selection of a drop down menu and an input field into an equation?
How do you place the selection of a drop down menu and an input field into an equation?

Time:01-25

What am I doing

I have a picture framing calculator which caters to calculating the appropriate Current equations solving correctly


The Problem

I am trying to alter my equations to include my input and the drop down selection. I updated both equations with how I think it should go, but now receive the error NaN NaN/1. However, this is an image of the result when I attempt the new equations and I try to utilize the drop down menu.:

Calculator with script changes

The Mat Overlap drop down menu works, but the incorporation of the drop down menus which correspond with the Frame Width, Frame Height, Picture Width, and Picture Height are creating the error I believe. I can't figure what I'm missing.


What I've tried

I've tried the following equations:

  1. var width = (1/2)*(hf hpf-hp hpf o); and var height = (1/2)*(wf wff-wp wpf o);
  2. var width = (1/2)*((hf hpf)-(hp hpf) o); and var width = (1/2)*((wf wff)-(wp wpf) o);

CodePudding user response:

Thank you

  1. How do you place the selection of a drop down menu and an input field into an equation?

Hello, the Map Overlap is using parseFloat while the others is using parseInt. If you want to use parseInt you need to specify 0 in front the decimal parseInt(0.0625). Otherwise it will become Nan. – fatin amirah


  1. How to combine the numbers of an input field and an option from a drop down selection in order to solve an equation?

you need to change string to the interger or float by using parseFloat and parseInt I have added the solution for this.


This was two topics that came together.

  1. How to combine the numbers of an input field and an option from a drop down selection in order to solve an equation?

This discussion concerned placing the mathematics together for the equations. By change string to the interger or float by using parseFloat and parseInt I have added the solution. All variables were declared & added to the equation. Solution is available on above link on #1

  1. How do you place the selection of a drop down menu and an input field into an equation?

This question addressed how the change affected the replacement, newer equations. As they simply would not work.

The Solution To This Problem

Changing all drop down numbers to have a 0 in front of the decimal. For example, 0.0 became 0, .75 became 0.75.

And completely removed all instances of the following: <option value="none" selected="selected"> -- choose one --</option>

This has eliminated the 'NaN' issue.

The final Fiddle can be found here: https://jsfiddle.net/1rcmoj9x/1/

  •  Tags:  
  • Related