Squiggle Master
Posts: 0
Joined: Thu Feb 06, 2014 6:50 pm

Javascript Farenheit To Celsius Linking To Button Problem

I did the following.
Clicked on the button, Opened events, Selected event click, Selected action run javascript, and typed this in:
function convertToC() {
var fTempVal = parseFloat(Appery("mobiletextinput_10").val());
var cTempVal = (fTempVal - 32) * (5 / 9);
document.getElementById('cTemp').value = cTempVal;
return false;
}

I'm not sure why it is not working can anybody help?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Javascript Farenheit To Celsius Linking To Button Problem

Do you invoke this function on button click?
Are there any JS errors in browser console? http://docs.appery.io/documentation/d...

Squiggle Master
Posts: 0
Joined: Thu Feb 06, 2014 6:50 pm

Javascript Farenheit To Celsius Linking To Button Problem

It has this error: event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
But in the javascript creator there don't seem to be any errors. The linking may not be correct.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Javascript Farenheit To Celsius Linking To Button Problem

Replace your code with the following:

pre
code
function convertToC() {
var fTempVal = parseFloat(Appery("mobiletextinput_10").val());
var cTempVal = (fTempVal - 32) * (5 / 9);
Appery("temperature2").text(cTempVal);
return false;
}
convertToC();
/code
/pre

Return to “Issues”