diff --git a/api/businesses/saveBrandColor.cfm b/api/businesses/saveBrandColor.cfm index cd744be..368a94f 100644 --- a/api/businesses/saveBrandColor.cfm +++ b/api/businesses/saveBrandColor.cfm @@ -49,7 +49,7 @@ if (len(brandColor) GT 0) { // Update the database queryExecute(" UPDATE Businesses - SET BrandColor = :color + SET BusinessBrandColor = :color WHERE BusinessID = :bizId ", { color: { value: brandColor, cfsqltype: "cf_sql_varchar" }, diff --git a/portal/portal.js b/portal/portal.js index 970d5e3..f2d2a79 100644 --- a/portal/portal.js +++ b/portal/portal.js @@ -1215,6 +1215,7 @@ const Portal = { hexInput.addEventListener('input', () => { let color = hexInput.value; + if (/^[0-9A-Fa-f]{6}$/.test(color)) color = '#' + color; if (/^#[0-9A-Fa-f]{6}$/.test(color)) { colorInput.value = color; preview.style.background = `linear-gradient(to bottom, ${color}44, ${color}00, ${color}66)`; @@ -1225,8 +1226,8 @@ const Portal = { // Save brand color async saveBrandColor() { const color = document.getElementById('brandColorHex').value.toUpperCase(); - if (!/^#[0-9A-Fa-f]{6}$/.test(color)) { - this.toast('Please enter a valid hex color (e.g., #1B4D3E)', 'error'); + if (!/^#?[0-9A-Fa-f]{6}$/.test(color)) { + this.toast('Please enter a valid hex color (e.g., #1B4D3E or 1B4D3E)', 'error'); return; }