No way to get native Webflow Attributes?

It seems like currently if I need to get a native Webflow attribute from within a designer extension like “id” for normal elements, “name” or “type” for input elements, this is impossible with the Designer APIs, since these elements don’t implement the DOMElement interface.

image

interface ParagraphElement
  extends WebflowElement,
    Configurable,
    CustomAttributes,
    DomId,
    Styles,
    Children,
    TextContent {
  readonly id: ElementId;
  readonly type: 'Paragraph';
  readonly plugin: 'Basic';
}
interface FormTextInputElement
  extends WebflowElement,
    Configurable,
    CustomAttributes,
    NoDomId,
    Styles,
    NoChildren,
    NoTextContent {
  readonly id: ElementId;
  readonly type: 'FormTextInput';
  readonly plugin: 'Form';
}

I can only get the custom attributes but not the native attributes. Is there a workaround for this? Is this on the roadmap?

Hey @mikepecha!

You should be able to get it using the get element attribute function: DOMElements

You will need to specify the attribute you’re wanting to get (I.e. “id”), it will return NULL if none exist.

Hi @jonohale

Unfortunately normal Webflow elements like an Input or a Div block are not DOM elements. And so this is not possible

Ah yes you’re correct! My mistake.

You can use .getDomId() on the selected elements ID if one is set (i.e. el.getDomId()).

However, I don’t think there is any way to get the element name just yet using the Designer API.

You can use the data API to get form schema: Get Form Schema