Page 1 of 1

How do you make a farenheit to celsius converter?

Posted: Thu Feb 06, 2014 6:59 pm
by Squiggle Master

I want to make a farenheit to celsius converter for my weather app can anybody help?


How do you make a farenheit to celsius converter?

Posted: Thu Feb 06, 2014 7:10 pm
by Maryna Brodina

You have to add custom JS with formula to convert fahrenheit to celsius.


How do you make a farenheit to celsius converter?

Posted: Thu Feb 06, 2014 7:11 pm
by Squiggle Master

I'm not exactly sure of the javascript needed and I want to try and link it to a button and an input box.


How do you make a farenheit to celsius converter?

Posted: Thu Feb 06, 2014 7:14 pm
by Squiggle Master

I think this javascript or one of either should be fine but I need help linking it to the input box and button. Please correct it if it is wrong.
function convertToC() {
var fTempVal = parseFloat(document.getElementById('fTemp').value);
var cTempVal = (fTempVal - 32) * (5 / 9);
document.getElementById('cTemp').value = cTempVal;
return false;
}

Code: Select all

 function convertToF() { 
     var cTempVal = parseFloat(document.getElementById('cTemp').value); 
     var fTempVal = (cTempVal * (9 / 5)) + 32; 
     console.log(fTempVal); 
     document.getElementById('fTemp').value = fTempVal; 
     return false; 
 }

How do you make a farenheit to celsius converter?

Posted: Thu Feb 06, 2014 8:25 pm
by Maryna Brodina

Instead predocument.getElementById('cTemp').value/pre use preAppery("componentName").val();/preOn button click add action Run JS and add body of necessary function (not entire function, just function content) to action.


How do you make a farenheit to celsius converter?

Posted: Sat Feb 08, 2014 6:08 pm
by Squiggle Master

I don't get the part about linking the button to the javascript can you help?
I can't see add action.


How do you make a farenheit to celsius converter?

Posted: Sat Feb 08, 2014 6:45 pm
by Illya Stepanov

Hello -- Please take a look here: http://docs.appery.io/documentation/w...