forex text input to dropdown menu
This commit is contained in:
parent
9b77876712
commit
a639cb343b
158
static/app.js
158
static/app.js
@ -746,7 +746,7 @@ var allFeaturesFileAddBtn = [
|
|||||||
// features input text
|
// features input text
|
||||||
var stocksText = document.getElementById("inputText3");
|
var stocksText = document.getElementById("inputText3");
|
||||||
var cryptoText = document.getElementById("inputText4");
|
var cryptoText = document.getElementById("inputText4");
|
||||||
var forexText = document.getElementById("inputText5");
|
var forexText = document.getElementById("base-select").value + ',' + document.getElementById("quote-select").value;
|
||||||
var currentWeatherText = document.getElementById("inputText6");
|
var currentWeatherText = document.getElementById("inputText6");
|
||||||
var dailyForecastText = document.getElementById("inputText7");
|
var dailyForecastText = document.getElementById("inputText7");
|
||||||
var messagesText = document.getElementById("inputText13");
|
var messagesText = document.getElementById("inputText13");
|
||||||
@ -903,10 +903,13 @@ allFeaturesTextAddBtn.map((value, index) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else{
|
else{
|
||||||
|
|
||||||
if (createLi === true) {
|
if (createLi === true) {
|
||||||
var tag = document.createElement("li");
|
var tag = document.createElement("li");
|
||||||
tag.innerHTML = allFeaturesText[index].value;
|
if (index == 2) {
|
||||||
|
tag.innerHTML= document.getElementById("base-select").value + ',' + document.getElementById("quote-select").value;
|
||||||
|
} else{
|
||||||
|
tag.innerHTML = allFeaturesText[index].value;
|
||||||
|
}
|
||||||
allFeatures[index].appendChild(tag);
|
allFeatures[index].appendChild(tag);
|
||||||
changeVarValue();
|
changeVarValue();
|
||||||
addEventOnFeaturesList();
|
addEventOnFeaturesList();
|
||||||
@ -2245,95 +2248,96 @@ var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/;
|
|||||||
|
|
||||||
|
|
||||||
// Forex validation
|
// Forex validation
|
||||||
|
|
||||||
function forexValidate() {
|
function forexValidate() {
|
||||||
|
createLi = true;
|
||||||
|
}
|
||||||
|
|
||||||
var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/;
|
// var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/;
|
||||||
|
|
||||||
let x = document.getElementById("inputText5").value;
|
// let x = document.getElementById("inputText5").value;
|
||||||
let quoteCurrency = x.split(",")[1];
|
// let quoteCurrency = x.split(",")[1];
|
||||||
let baseCurrency = x.split(",")[0];
|
// let baseCurrency = x.split(",")[0];
|
||||||
|
|
||||||
// console.log("base"+baseCurrency);
|
// // console.log("base"+baseCurrency);
|
||||||
// console.log("quote"+quoteCurrency);
|
// // console.log("quote"+quoteCurrency);
|
||||||
|
|
||||||
let text;
|
// let text;
|
||||||
if (x.toUpperCase() != x) {
|
// if (x.toUpperCase() != x) {
|
||||||
document.getElementById('demo3').style.display = "block";
|
// document.getElementById('demo3').style.display = "block";
|
||||||
text = "Base and quote must be uppercase";
|
// text = "Base and quote must be uppercase";
|
||||||
document.getElementById("inputText5").value = '';
|
// document.getElementById("inputText5").value = '';
|
||||||
// createLi = false;
|
// // createLi = false;
|
||||||
}
|
// }
|
||||||
else if (x === '') {
|
// else if (x === '') {
|
||||||
document.getElementById('demo3').style.display = "block";
|
// document.getElementById('demo3').style.display = "block";
|
||||||
text = "No blanks"
|
// text = "No blanks"
|
||||||
}
|
// }
|
||||||
|
|
||||||
else if (x.includes(' ')) {
|
// else if (x.includes(' ')) {
|
||||||
text = "No spaces";
|
// text = "No spaces";
|
||||||
document.getElementById('demo3').style.display = "block";
|
// document.getElementById('demo3').style.display = "block";
|
||||||
document.getElementById("inputText5").value = '';
|
// document.getElementById("inputText5").value = '';
|
||||||
}
|
// }
|
||||||
|
|
||||||
else if (/\d/.test(x)) {
|
// else if (/\d/.test(x)) {
|
||||||
document.getElementById('demo3').style.display = "block";
|
// document.getElementById('demo3').style.display = "block";
|
||||||
text = "No numbers allowed";
|
// text = "No numbers allowed";
|
||||||
document.getElementById("inputText5").value = '';
|
// document.getElementById("inputText5").value = '';
|
||||||
}
|
// }
|
||||||
// CAREFUL TO DELETE THE BACKEND LIST ITEMS, JUST DELETING THE VALUE LIKE THIS ISN"T 100% ACCURATE
|
// // CAREFUL TO DELETE THE BACKEND LIST ITEMS, JUST DELETING THE VALUE LIKE THIS ISN"T 100% ACCURATE
|
||||||
|
|
||||||
else if (specialChars.test(x)) {
|
// else if (specialChars.test(x)) {
|
||||||
document.getElementById('demo3').style.display = "block";
|
// document.getElementById('demo3').style.display = "block";
|
||||||
text = "No special characters allowed";
|
// text = "No special characters allowed";
|
||||||
document.getElementById("inputText5").value = '';
|
// document.getElementById("inputText5").value = '';
|
||||||
}
|
// }
|
||||||
|
|
||||||
else if (!x.includes(',')) {
|
// else if (!x.includes(',')) {
|
||||||
document.getElementById('demo3').style.display = "block";
|
// document.getElementById('demo3').style.display = "block";
|
||||||
document.getElementById("inputText5").value = '';
|
// document.getElementById("inputText5").value = '';
|
||||||
text = "Missing ',' (e.g. EUR,USD)"
|
// text = "Missing ',' (e.g. EUR,USD)"
|
||||||
}
|
// }
|
||||||
|
|
||||||
else if (x.length > 7) {
|
// else if (x.length > 7) {
|
||||||
document.getElementById('demo3').style.display = "block";
|
// document.getElementById('demo3').style.display = "block";
|
||||||
text = "No more than 7 characters";
|
// text = "No more than 7 characters";
|
||||||
document.getElementById("inputText5").value = '';
|
// document.getElementById("inputText5").value = '';
|
||||||
}
|
// }
|
||||||
|
|
||||||
else if (!["USD","EUR","JPY","GBP","AUD","CAD","CHF","CNY","HKD","NZD","SEK","KRW","SGD","NOK","MXN","INR","RUB","ZAR","TRY","BRL",
|
// else if (!["USD","EUR","JPY","GBP","AUD","CAD","CHF","CNY","HKD","NZD","SEK","KRW","SGD","NOK","MXN","INR","RUB","ZAR","TRY","BRL",
|
||||||
"TWD","DKK","PLN","THB","IDR","HUF","ILS","CLP","PHP","AED","CZK","COP","SAR","MYR","RON","CLP","ARS","VND","QAR","KWD"].includes(baseCurrency)) {
|
// "TWD","DKK","PLN","THB","IDR","HUF","ILS","CLP","PHP","AED","CZK","COP","SAR","MYR","RON","CLP","ARS","VND","QAR","KWD"].includes(baseCurrency)) {
|
||||||
document.getElementById('demo3').style.display = "block";
|
// document.getElementById('demo3').style.display = "block";
|
||||||
document.getElementById("inputText5").value = '';
|
// document.getElementById("inputText5").value = '';
|
||||||
text = "Invalid base currency"
|
// text = "Invalid base currency"
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
else if (!["AED","AFN","ALL","AMD","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BMD","BND","BOB","BRL","BSD", "BTN", "BWP", "BYN",
|
// else if (!["AED","AFN","ALL","AMD","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BMD","BND","BOB","BRL","BSD", "BTN", "BWP", "BYN",
|
||||||
"BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR",
|
// "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR",
|
||||||
"FJD", "FKP", "FOK", "GBP", "GEL", "GGP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP",
|
// "FJD", "FKP", "FOK", "GBP", "GEL", "GGP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP",
|
||||||
"INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY","KES","KGS","KHR","KID","KMF","KRW","KWD", "KYD","KZT","LAK","LBP","LKR","LRD","LSL", "LYD",
|
// "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY","KES","KGS","KHR","KID","KMF","KRW","KWD", "KYD","KZT","LAK","LBP","LKR","LRD","LSL", "LYD",
|
||||||
"MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRU","MUR","MVR","MWK","MXN","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN",
|
// "MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRU","MUR","MVR","MWK","MXN","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN",
|
||||||
"PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","SSP","STN","SYP","SZL",
|
// "PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","SSP","STN","SYP","SZL",
|
||||||
"THB","TJS","TMT","TND","TOP","TRY","TTD","TVD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VES","VND","VUV","WST","YER","ZAR"].includes(quoteCurrency)) {
|
// "THB","TJS","TMT","TND","TOP","TRY","TTD","TVD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VES","VND","VUV","WST","YER","ZAR"].includes(quoteCurrency)) {
|
||||||
document.getElementById('demo3').style.display = "block";
|
// document.getElementById('demo3').style.display = "block";
|
||||||
document.getElementById("inputText5").value = '';
|
// document.getElementById("inputText5").value = '';
|
||||||
text = "Invalid quote currency"
|
// text = "Invalid quote currency"
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
else {
|
// else {
|
||||||
text = "Input OK";
|
// text = "Input OK";
|
||||||
document.getElementById('demo3').style.display = "none";
|
// document.getElementById('demo3').style.display = "none";
|
||||||
createLi = true;
|
// createLi = true;
|
||||||
// CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST
|
// // CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST
|
||||||
// addingItems();
|
// // addingItems();
|
||||||
setTimeout(
|
// setTimeout(
|
||||||
function() {
|
// function() {
|
||||||
document.getElementById('inputText5').value="";
|
// document.getElementById('inputText5').value="";
|
||||||
}, 100);
|
// }, 100);
|
||||||
}
|
// }
|
||||||
document.getElementById("demo3").innerHTML = text;
|
// document.getElementById("demo3").innerHTML = text;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// Custom messages validation
|
// Custom messages validation
|
||||||
|
Loading…
Reference in New Issue
Block a user