• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 35
  • Last Modified:

2 minor adjustments to code

When the combobox is changed put the selected combo text into this label:
<h3 id="Result">Select Pitch</h3>
Example:
<h3 text is: Select Pitch
user selects 8/12 pitch from the combobox
<h3 text now says 8/12 pitch
The reset button does nothing
its supposed to run the function:  clearFields
The code to run the function:
<input type="button" value="Reset" onClick="clearFields()">
The page :
http://roofgenius.com/test7.asp
0
isnoend2001
Asked:
isnoend2001
  • 6
  • 3
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
For some reason, Firefox says that 'clearFields' is undefined.  I can see it in the "View Source" but I don't know why it's not working.
0
 
isnoend2001Author Commented:
Thanks Dave it was working yesterday and it just stopped
0
 
isnoend2001Author Commented:
I am going to try moving the clearFields into the body
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
isnoend2001Author Commented:
For some reason that worked
http://roofgenius.com/test8.asp
0
 
Dave BaldwinFixer of ProblemsCommented:
You still have a minor problem on Line 75 with 'Int' according to Firefox.
0
 
isnoend2001Author Commented:
This line:
inVal=inVal==Int(inVal)?Int(inVal):inVal;
what could that be ?
0
 
Dave BaldwinFixer of ProblemsCommented:
It says 'Int' is invalid.  'Int' is not a keyword in javascript so it's trying to find it as a variable.
0
 
isnoend2001Author Commented:
found this:
Int

Definition: At one stage it was planned that specific data types would be introduced into the Javascript language. int is one the data types that would have been able to be explicitly defined. To allow for this int was a reserved word. The plan to allow specific data types in Javascript no longer exists and int is therefore no longer on the reserved word list in the latest standards. Since many people still use earlier browsers where this was defined as a reserved word you should avoid using it.

I will post another question on how to fix it
0
 
Scott Fell, EE MVEDeveloperCommented:
I know I didn't put that there.  What is it doing? or what did you ask to be done?

This function shouldn't be in the body
 // THIS FUNCTION WILL CLEAR OUT ALL OF THE FIELDS.  WE RUN THIS WHEN THERE IS AN ERROR
     function clearFields() {  
         $('#in').val('');
         $('#Multiplier').text('');
         $('#FeetAdded').text('');
         $('#Total').text('');
         $('#TotalSqs').text('');
     }

Open in new window

If it is only working there, that means something else is wrong.  Kind of like taking a pain pill when you have a deep wound in your arm.   The pain pill may stop the pain, but it does not fix the problem of needing stitches.

You can put that function where I have my comment.
 // THIS FUNCTION WILL RUN ALL OF OUR CALCULATIONS
     function calc(roofAreaVal) {
          // DO ALL OF OUR MATH
         InPutFeet = parseInt($('#in').val(), 10); //InPutFeet = Users input into textbox
         Multipler = parseFloat(roofAreaVal).toFixed(2); //Multipler = ComboBox selected value
         FeetToAdd = (parseInt(InPutFeet, 10) * parseFloat(Multipler)).toFixed(2); //FeetToAdd = InPutFeet * Multipler
         TotalFeet = parseInt(InPutFeet, 10) + parseFloat(FeetToAdd); //TotalFeet = InPutFeet + FeetToAdd		
         TotalSquares = TotalFeet / 100; //TotalSquares = TotalFeet / 100
       TotalSquares = parseFloat(TotalSquares).toFixed(2);
          // UPDATE OUR FIELDS
         $('#Multiplier').text(Multipler);
         $('#FeetAdded').text(FeetToAdd);
         $('#Total').text(TotalFeet);
         $('#TotalSqs').text(TotalSquares);
     }
// ************** add clearFields() function here ************

 });
 </script>

Open in new window



Not directly related, but you should keep your css above your js.
0
 
isnoend2001Author Commented:
Thanks padas
Not directly related, but you should keep your css above your js.
Did not realize that.
Was told this line was giving error:
inVal=inVal==Int(inVal)?Int(inVal):inVal;
EE coder said firefox was reporting error on int
Don't how he used firefox to see errors
So i changed it to:
inVal=inVal==Math.round(inVal)?Math.round(inVal):inVal;//changed
The change wll probably allow the function clearfields to be moved back to the head
I am assuming that java script it bails and does not read anything further
The page is getting there, glad you guys are here
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now