Fix brand color save: use BusinessBrandColor column, allow # to be optional

- saveBrandColor.cfm: BrandColor -> BusinessBrandColor (normalized column name)
- portal.js: Accept hex colors with or without # prefix in validation
- portal.js: Auto-prepend # when typing bare hex in color input

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-01-31 14:27:44 -08:00
parent 498ebb6c0e
commit 469cc06a29
2 changed files with 4 additions and 3 deletions

View file

@ -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" },

View file

@ -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;
}