90 lines
2.5 KiB
JavaScript
90 lines
2.5 KiB
JavaScript
/*
|
|
The following errors were found when attempting to minify this file:
|
|
- Line 58: Parse error. syntax error
|
|
- Line 59: Parse error. syntax error
|
|
- Line 60: Parse error. missing ; before statement
|
|
- Line 61: Parse error. missing ; before statement
|
|
*/
|
|
// Removes non-decimal characters from a string.
|
|
function removeNonDecimalChars(text) {
|
|
if (text == null)
|
|
return null;
|
|
else if (!(typeof (text) == 'string' || text instanceof String))
|
|
text = text.toString();
|
|
|
|
// Handle cultures with other separators (e.g. France uses ',' for decimal separator).
|
|
var decSep = getNumericDecimalSeparator();
|
|
|
|
if (decSep != '.')
|
|
text = text.replace(new RegExp('\\' + decSep, 'g'), '.');
|
|
|
|
return text.replace(/[^0-9.\-]/g, '');
|
|
}
|
|
|
|
// Helper method for FormElementVerify().
|
|
function formElementVerifyPositiveInteger(elem, errorList, altMessage) {
|
|
var text = elem.value;
|
|
|
|
if (!(typeof (text) == 'string' || text instanceof String))
|
|
text = text.toString();
|
|
|
|
text = removeNonDecimalChars(text);
|
|
var parsedIntValue = parseInt(text);
|
|
var parsedFloatValue = parseFloat(text);
|
|
|
|
if (parsedIntValue == parsedFloatValue && parsedIntValue > -1) {
|
|
elem.value = parsedIntValue;
|
|
return true;
|
|
}
|
|
else {
|
|
if (errorList)
|
|
errorList.push(altMessage == null ? 'The value must be a positive integer.' : altMessage);
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// Helper method for FormElementVerify().
|
|
function formElementVerifyPositiveDecimal(elem, errorList, altMessage) {
|
|
var cleanValue = removeNonDecimalChars(elem.value);
|
|
|
|
if (!isNaN(cleanValue) && cleanValue != '' && parseFloat(cleanValue) >= 0) {
|
|
elem.value = cleanValue;
|
|
return true;
|
|
}
|
|
else {
|
|
if (errorList)
|
|
errorList.push(altMessage == null ? 'The value must be a positive number.' : altMessage);
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function verifyFormStatus() {
|
|
const params = new Proxy(new URLSearchParams(window.location.search), {
|
|
get: (searchParams, prop) => searchParams.get(prop),
|
|
});
|
|
let fid = parseInt(params.fid || params.FID);
|
|
let status = null;
|
|
$.ajax({
|
|
url: '/Admin/Forms/FormHeader/FormStatus?formHeaderID=' + fid,
|
|
type: 'GET',
|
|
cache: false,
|
|
async: false,
|
|
success: function (response) {
|
|
status = response.Status;
|
|
if (response.Success && status == 40) {
|
|
return true;
|
|
}
|
|
else {
|
|
alert("This form is currently not accepting responses.");
|
|
}
|
|
},
|
|
error: function (xhr, textStatus, exception) {
|
|
alert("Error: " + xhr.statusText + "\nStatus: " + xhr.status);
|
|
return false;
|
|
}
|
|
});
|
|
};
|
|
|