Form Fields

Generated reference for the iPrintessApi methods tagged #ai-api:form-fields in printess-editor.d.ts. Custom types referenced below (parameter and return shapes) are documented on the Types reference.

getFormField

getFormField(fieldName: string): Promise<{
    value: null | string | number | Array<Record<string, any>>,
    list?: Array<{
      key: string,
      label?: string,
      description?: string,
      imageId?: string,
      tag?: string,
      meta1?: string,
      meta2?: string,
      meta3?: string,
      meta4?: string,
      disabled?: boolean
    }>
  } | undefined>

Returns the current form field value and its possible list values if available Important: Only returns values of price-relevant form-fields!

Parameter Type Description
fieldName string Name of the Form-Field or Form-Field Property-ID

Returns: Promise<{ value: null | string | number | Array<Record<string, any>>, list?: Array<{ key: string, label?: string, description?: string, imageId?: string, tag?: string, meta1?: string, meta2?: string, meta3?: string, meta4?: string, disabled?: boolean }> } | undefined>

getFormFieldImageList

getFormFieldImageList(fieldName: string): Array<iExternalFormFieldImageListItem>

Returns a list of images from the Form Field Select List

Parameter Type Description
fieldName string

Returns: Array<iExternalFormFieldImageListItem>

getFormFieldNameByExternalPropertyId

getFormFieldNameByExternalPropertyId(properyId: string): string | null

Returns the name of a form field if property-id points to an existing form field

Parameter Type Description
properyId string External Property ID

Returns: string | null

getFormFieldsAsProperties

getFormFieldsAsProperties(tabId?: "#FORMFIELDS" | "#FORMFIELDS1" | "#FORMFIELDS2"): iExternalProperty[]

Retrieves all Form Fields for UI rendering

Parameter Type Description
tabId? “#FORMFIELDS” | “#FORMFIELDS1” | “#FORMFIELDS2” optional to get FFs for certain tab only

Returns: iExternalProperty[]

getFormFieldSelectedImage

getFormFieldSelectedImage(fieldName: string): iExternalImage | undefined

Looks up a Form Field with fieldName and if the Form Field has a selected image in its list or if the Form Field is of type “imageId” it returns the selected image.

Parameter Type Description
fieldName string

Returns: iExternalImage | undefined

getFormFieldValue

getFormFieldValue(fieldName: string): undefined | string | number | Array<Record<string, any>>

Retrieves the current value of a form field Not async and always reads the live document, so it is safe to call at any time - including from inside an already open dialog or panel, where form.<name> may still report the value from before your own setFormFieldValue(). Returns undefined if no form field of that name exists. A table field returns its rows as an array, a number field a number, a label field always “”, everything else a string. The value is unformatted, so it can be passed straight back into setFormFieldValue().

Parameter Type Description
fieldName string Name of the Form-Field or Form-Field Property-ID. If name is not found, Printess will try to find the Form-Field by its label. This fallback scenario is helpfull for shop integrations where the shop has no way to map labels to name.

Returns: undefined | string | number | Array<Record<string, any>>

hasFormFields

hasFormFields(): boolean

Indicates if form fields are available

Returns: boolean

isFontFormField

isFontFormField(propertyId: string): Promise<boolean>

Returns if property is a form field of type font

Parameter Type Description
propertyId string

Returns: Promise<boolean>

isPropertyVisible

isPropertyVisible(propertyId: string, wasVisibleBefore?: boolean): boolean

Returns only false if property refers to a formfield which is not visible, because it doesn’ match a specific condition.

Parameter Type Description
propertyId string ID of property to check
wasVisibleBefore? boolean

Returns: boolean

setFormFieldListDisabledStates

setFormFieldListDisabledStates(ffName: string, states: Array<{ value: string, disabled: boolean }>): Promise<void>

Allows to set the disabled flag for certain items in a form field list.

Parameter Type Description
ffName string FF-Name to address
states Array<{ value: string, disabled: boolean }> List of value/disabled pairs

Returns: Promise<void>

Used in these examples:

setFormFieldProperties

setFormFieldProperties(formFieldProperties?: iFormFieldProperty[]): Promise<void>

Same like in the attach parameter, allows e.g. to modify list values in response to a user interaction.

Parameter Type Description
formFieldProperties? iFormFieldProperty[] List of FormField-Names (key) and their respective properties to change

Returns: Promise<void>

setFormFieldValue

setFormFieldValue(fieldName: string, newValue: string): Promise<void>

Sets the value of a form field Important! setFormFieldValue should always be called with ‘await’ to make sure the change gets populated!

Parameter Type Description
fieldName string Name of the Form-Field or Form-Field Property-ID. If name is not found, Printess will try to find the Form-Field by its label. This fallback scenario is helpfull for shop integrations where the shop has no way to map labels to name.
newValue string Must be string and will be converted if neccessary

Returns: Promise<void>

Used in these examples: