Loading plugins/survey/survey.cpp +13 −6 Changes for plugins/survey/survey.cpp: 13 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -427,7 +427,14 @@ namespace blogi { bool found = false; for (const auto &opt : q.options) if (opt.value == val) { found = true; break; } if (!found) return "Invalid value for " + q.id; if (!found) { std::cerr << "survey: validation failed for " << q.id << " type=" << q.type << " multiSelect=" << q.multiSelect << " submitted='" << val << "' options=["; for (size_t oi = 0; oi < q.options.size(); ++oi) std::cerr << (oi ? "," : "") << "'" << q.options[oi].value << "'"; std::cerr << "]" << std::endl; return "Invalid value for " + q.id; } } } else if (q.type == "checkbox" || (q.type == "icon" && q.multiSelect)) { if (!json_object_is_type(field, json_type_array)) Loading Loading @@ -1183,7 +1190,7 @@ namespace blogi { for (const auto &opt : q.options) { if (opt.value.empty() && opt.label.empty()) continue; html << "<div class=\"option\"><label><input type=\"radio\" name=\"" << q.id << "\" value=\"" << opt.value << "\""; << "\" value=\"" << htmlEscape(opt.value) << "\""; if (!opt.excludes.empty()) html << " data-excludes=\"" << opt.excludes << "\""; html << "/>" << opt.label << "</label></div>"; } Loading @@ -1193,7 +1200,7 @@ namespace blogi { if (opt.value.empty() && opt.label.empty()) continue; html << "<label class=\"icon-option\">" << "<input type=\"" << (q.multiSelect ? "checkbox" : "radio") << "\" name=\"" << q.id << "\" value=\"" << opt.value << "\""; << "\" value=\"" << htmlEscape(opt.value) << "\""; if (!opt.excludes.empty()) html << " data-excludes=\"" << opt.excludes << "\""; html << "/>"; if (!opt.icon.empty()) Loading @@ -1205,7 +1212,7 @@ namespace blogi { for (const auto &opt : q.options) { if (opt.value.empty() && opt.label.empty()) continue; html << "<div class=\"option\"><label><input type=\"checkbox\" name=\"" << q.id << "\" value=\"" << opt.value << "\""; << "\" value=\"" << htmlEscape(opt.value) << "\""; if (!opt.excludes.empty()) html << " data-excludes=\"" << opt.excludes << "\""; html << "/>" << opt.label << "</label></div>"; } Loading @@ -1213,7 +1220,7 @@ namespace blogi { html << "<select name=\"" << q.id << "\"><option value=\"\">-- Select --</option>"; for (const auto &opt : q.options) { if (opt.value.empty() && opt.label.empty()) continue; html << "<option value=\"" << opt.value << "\""; html << "<option value=\"" << htmlEscape(opt.value) << "\""; if (!opt.excludes.empty()) html << " data-excludes=\"" << opt.excludes << "\""; html << ">" << opt.label << "</option>"; } Loading Loading @@ -1465,7 +1472,7 @@ namespace blogi { << "else if(t.classList.contains('btn-prev'))wizardPrev();" << "else if(t.classList.contains('btn-submit'))submitSurvey();return;}" << "var ico=e.target.closest?e.target.closest('.icon-option'):null;" << "if(ico){var grid=ico.closest('.icon-grid');var multi=grid&&grid.getAttribute('data-multi')==='true';" << "if(ico){e.preventDefault();var grid=ico.closest('.icon-grid');var multi=grid&&grid.getAttribute('data-multi')==='true';" << "var inp=ico.querySelector('input');if(inp){" << "if(multi){inp.checked=!inp.checked;ico.classList.toggle('selected',inp.checked);}" << "else{inp.checked=true;if(grid){var all=grid.querySelectorAll('.icon-option');" Loading Loading
plugins/survey/survey.cpp +13 −6 Changes for plugins/survey/survey.cpp: 13 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -427,7 +427,14 @@ namespace blogi { bool found = false; for (const auto &opt : q.options) if (opt.value == val) { found = true; break; } if (!found) return "Invalid value for " + q.id; if (!found) { std::cerr << "survey: validation failed for " << q.id << " type=" << q.type << " multiSelect=" << q.multiSelect << " submitted='" << val << "' options=["; for (size_t oi = 0; oi < q.options.size(); ++oi) std::cerr << (oi ? "," : "") << "'" << q.options[oi].value << "'"; std::cerr << "]" << std::endl; return "Invalid value for " + q.id; } } } else if (q.type == "checkbox" || (q.type == "icon" && q.multiSelect)) { if (!json_object_is_type(field, json_type_array)) Loading Loading @@ -1183,7 +1190,7 @@ namespace blogi { for (const auto &opt : q.options) { if (opt.value.empty() && opt.label.empty()) continue; html << "<div class=\"option\"><label><input type=\"radio\" name=\"" << q.id << "\" value=\"" << opt.value << "\""; << "\" value=\"" << htmlEscape(opt.value) << "\""; if (!opt.excludes.empty()) html << " data-excludes=\"" << opt.excludes << "\""; html << "/>" << opt.label << "</label></div>"; } Loading @@ -1193,7 +1200,7 @@ namespace blogi { if (opt.value.empty() && opt.label.empty()) continue; html << "<label class=\"icon-option\">" << "<input type=\"" << (q.multiSelect ? "checkbox" : "radio") << "\" name=\"" << q.id << "\" value=\"" << opt.value << "\""; << "\" value=\"" << htmlEscape(opt.value) << "\""; if (!opt.excludes.empty()) html << " data-excludes=\"" << opt.excludes << "\""; html << "/>"; if (!opt.icon.empty()) Loading @@ -1205,7 +1212,7 @@ namespace blogi { for (const auto &opt : q.options) { if (opt.value.empty() && opt.label.empty()) continue; html << "<div class=\"option\"><label><input type=\"checkbox\" name=\"" << q.id << "\" value=\"" << opt.value << "\""; << "\" value=\"" << htmlEscape(opt.value) << "\""; if (!opt.excludes.empty()) html << " data-excludes=\"" << opt.excludes << "\""; html << "/>" << opt.label << "</label></div>"; } Loading @@ -1213,7 +1220,7 @@ namespace blogi { html << "<select name=\"" << q.id << "\"><option value=\"\">-- Select --</option>"; for (const auto &opt : q.options) { if (opt.value.empty() && opt.label.empty()) continue; html << "<option value=\"" << opt.value << "\""; html << "<option value=\"" << htmlEscape(opt.value) << "\""; if (!opt.excludes.empty()) html << " data-excludes=\"" << opt.excludes << "\""; html << ">" << opt.label << "</option>"; } Loading Loading @@ -1465,7 +1472,7 @@ namespace blogi { << "else if(t.classList.contains('btn-prev'))wizardPrev();" << "else if(t.classList.contains('btn-submit'))submitSurvey();return;}" << "var ico=e.target.closest?e.target.closest('.icon-option'):null;" << "if(ico){var grid=ico.closest('.icon-grid');var multi=grid&&grid.getAttribute('data-multi')==='true';" << "if(ico){e.preventDefault();var grid=ico.closest('.icon-grid');var multi=grid&&grid.getAttribute('data-multi')==='true';" << "var inp=ico.querySelector('input');if(inp){" << "if(multi){inp.checked=!inp.checked;ico.classList.toggle('selected',inp.checked);}" << "else{inp.checked=true;if(grid){var all=grid.querySelectorAll('.icon-option');" Loading