From e4592e822e865bbc3d3ae4d3aac0034fe2cd124f Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 12 Apr 2023 15:13:52 -0600 Subject: [PATCH] Api: If widget has autocomplete="on", set the name attribute for autocomplete --- api/js/etemplate/Et2InputWidget/Et2InputWidget.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts b/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts index 9a9820d905..4069116432 100644 --- a/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts +++ b/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts @@ -473,6 +473,13 @@ const Et2InputWidgetMixin = >(superclass : T) { super.transformAttributes(attrs); + // Set attributes for the form / autofill. It's the individual widget's + // responsibility to do something appropriate with these properties. + if(this.autocomplete == "on" && window.customElements.get(this.localName).getPropertyOptions("name") != "undefined") + { + this.name = this.getArrayMgr("content").explodeKey(this.id).pop(); + } + // Check whether an validation error entry exists if(this.id && this.getArrayMgr("validation_errors")) {