add message for emojis not supported on this type

main
alexanderroese 2024-07-25 22:07:47 +02:00
parent 7edb3de769
commit e4db478496
1 changed files with 3 additions and 3 deletions

View File

@ -554,7 +554,7 @@
function SHX_IFC_genTextInput(inputID, labelText, inputName, inputVal, section_id, maxLength = 24, emojisSupported = false) { function SHX_IFC_genTextInput(inputID, labelText, inputName, inputVal, section_id, maxLength = 24, emojisSupported = false) {
// helper function to check if string contains emoji on product variant which not support emojis // helper function to check if string contains emoji on product variant which not support emojis
function showErrorMessageIfEmojiNotSupported(value) { function showErrorMessageIfEmojiNotSupported(value, inputID) {
if (!emojisSupported && value.length > 0 && emojiRegex.test(value)) { if (!emojisSupported && value.length > 0 && emojiRegex.test(value)) {
console.log("here", value, "doc", document.querySelector(`label[for="${inputID}-label"] span`)) console.log("here", value, "doc", document.querySelector(`label[for="${inputID}-label"] span`))
@ -564,7 +564,7 @@
} }
setTimeout(() => { setTimeout(() => {
showErrorMessageIfEmojiNotSupported(document.querySelector(`#${inputID}`).value) showErrorMessageIfEmojiNotSupported(document.querySelector(`#${inputID}`).value, inputID)
document.querySelector(`#${inputID}`).addEventListener('input', (e)=>{ document.querySelector(`#${inputID}`).addEventListener('input', (e)=>{
if (!document.querySelector(`label[for="${inputID}-label"] span`)) { if (!document.querySelector(`label[for="${inputID}-label"] span`)) {
@ -580,7 +580,7 @@
document.querySelector(`label[for="${inputID}-label"] span`).style.color = 'red'; document.querySelector(`label[for="${inputID}-label"] span`).style.color = 'red';
} }
showErrorMessageIfEmojiNotSupported(e.target.value) showErrorMessageIfEmojiNotSupported(e.target.value, inputID)
}); });
}, 1000); }, 1000);