SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
Fix: 86ev8ze7j : Component Settings/Input Validation - Validation Message Disappears & Invalid Names Accepted
samme-abdul47aa6ca1e97c
diff --git a/packages/app/src/builder-ui/components/Component.class/index.ts b/packages/app/src/builder-ui/components/Component.class/index.tsindex 824a5c56..a204bb79 100644--- a/packages/app/src/builder-ui/components/Component.class/index.ts+++ b/packages/app/src/builder-ui/components/Component.class/index.ts@@ -1332,7 +1332,8 @@ export class Component extends EventEmitter {class: 'stg-input stg-name',value: name,readonly: defaultEP || templateDefaultEP,- validate: 'required custom=isValidInputName',+ validate: 'required',+ smythValidate: 'func=isValidInputName',validateMessage:'Name is required and can only contain letters, numbers, and underscores.',},diff --git a/packages/app/src/builder-ui/ui/form/createFormField.ts b/packages/app/src/builder-ui/ui/form/createFormField.tsindex fd331788..03feae74 100644--- a/packages/app/src/builder-ui/ui/form/createFormField.ts+++ b/packages/app/src/builder-ui/ui/form/createFormField.ts@@ -484,15 +484,26 @@ export default function createFormField(entry, displayType = 'block', entryIndexwindow['__FIELD_TEMPLATE_VARIABLES__'][entry?.name] = variables;}- // Hide error message when user starts typing if the field is invalid- formElement.addEventListener('keyup', (e) => {- const _this = e.target as HTMLElement;- const formControl = _this.closest('.form-control');-- if (formControl?.classList?.contains('invalid')) {- formControl.classList.remove('invalid');- }- });+ // Real-time validation - only clear error when field becomes valid+ if ((entry.validate?.includes('custom') || entry.smythValidate?.includes('func=')) && formElement.tagName !== 'SELECT') {+ formElement.addEventListener('input', async (e: Event) => {+ const input = e.target as HTMLInputElement;+ const formControl = input.closest('.form-control');+ const value = input.value.trim();++ // Extract validator function name (supports both func= and custom= formats)+ const match = (entry.smythValidate || entry.validate)?.match(/(?:func|custom)=(\w+)/);+ const validatorFunc = match && (window as any)[match[1]];++ // Validate and update UI+ if (value && validatorFunc) {+ const isValid = await Promise.resolve(validatorFunc(value));+ formControl?.classList.toggle('invalid', !isValid);+ } else if (!value && (entry.validate?.includes('required') || entry.required)) {+ formControl?.classList.add('invalid');+ }+ });+ }let labelElement = null;if (label /*&& displayType !== 'inline'*/) {