Uncaught ReferenceError: calcAll is not defined
Why am I getting the following error:
Uncaught ReferenceError: calcAll is not defined
calcAll is defined in the Javascript window for the form.
It is called from the OnClick of the Save button (buttons turned on).
**** Javascript ****
**** Save OnClick ****
Uncaught ReferenceError: calcAll is not defined
calcAll is defined in the Javascript window for the form.
It is called from the OnClick of the Save button (buttons turned on).
**** Javascript ****
Code: Select all
function convertDecimalToDegree(data) {
data.degree = Math(Math.trunc(data.decimal));
data.minutes = Math.abs((data.decimal - Math.trunc(data.decimal))*60);
data.seconds = (data.minutes - Math.trunc(data.minutes))*60;
}
function calcLatitude(){
var data = {"decimal" : fd.field("GpsLatitude").value(),
"degree" : 0,
"minutes" : 0,
"seconds" : 0};
convertDecimalToDegree(data);
var compass = data.decimal < 0 ? "S" : "N";
var text = data.degree + '°' + data.minutes.toFixed(1) + "'" + data.seconds.toFixed(1) + '"' + compass;
fd.field("GpsLatitudeText").value(text);
}
function calcLongitude(){
var data = {"decimal" : fd.field("GpsLongitude").value(),
"degree" : 0,
"minutes" : 0,
"seconds" : 0};
convertDecimalToDegree(data);
var compass = data.decimal < 0 ? "W" : "E";
var text = data.degree + '°' + data.minutes.toFixed(1) + "'" + data.seconds.toFixed(1) + '"' + compass;
fd.field("GpsLongitudeText").value(text);
}
function calcAll(){
calcLatitude();
calcLongitude();
}
**** Save OnClick ****
Code: Select all
calcAll();
City of Nampa
Idaho
United States of America
Idaho
United States of America
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Run this code inside JS editor instead:
Or something along these lines.
It is important to return true to save the form. But if you don't want to save item yet, simply return false.
Code: Select all
fd.onsubmit(function(){
calcAll();
return true;
});
It is important to return true to save the form. But if you don't want to save item yet, simply return false.
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 4 guests