Skip to main content

Form Data

Description

Provide your function that will return data from your table that will be used by the MRAD to create a form and enable input and correction of your data.

Create

Create your function that will return the data in the format specified in the example.

tip

There should also be data in your list for each language selection option. The MRAD will select the appropriate data based on the selected language and display it in a list.

Example:

src/admin/actions.ts
export async function heroFormData(primaryColumnValue: string): Promise<Object[]> {
const data: any = {
1: [
{
id_hero: 1,
title: 'We create furniture',
description: 'We create and make furniture according to your wishes...',
image_alt: null,
button_text: 'Explore more...',
locale: 'en',
display: 1,
text_position: 0,
title_color: '#a7a77c',
description_color: 'rgba(0, 0, 0, 0.8)',
background_color: null,
background_image_path: '/assets/images/logo/logo.png',
background_height: 700,
image_path: null,
image_height: null,
button_link: '#',
date_add: '2024-10-27T12:18:40.000Z',
date_upd: '2024-10-27T12:18:40.000Z'
},
{
id_hero: 1,
title: 'Wir schaffen Möbel',
description: 'Wir entwerfen und fertigen Möbel nach Ihren Wünschen...',
image_alt: null,
button_text: 'Mehr entdecken...',
locale: 'de',
display: 1,
text_position: 0,
title_color: '#a7a77c',
description_color: 'rgba(0, 0, 0, 0.8)',
background_color: '#a7a77c',
background_image_path: '/assets/images/logo/logo.png',
background_height: 700,
image_path: null,
image_height: null,
button_link: '#',
date_add: '2024-10-27T12:18:40.000Z',
date_upd: '2024-10-27T12:18:40.000Z'
}
],
2: [
{
id_hero: 2,
title: 'Bedrooms',
description: 'We create baedrooms that are both functional and stylish.',
image_alt: null,
button_text: 'Explore more...',
locale: 'en',
display: 1,
text_position: 0,
title_color: '#a7a77c',
description_color: 'rgba(0, 0, 0, 0.8)',
background_color: '#1128da',
background_image_path: '/assets/images/logo/logo.png',
background_height: 700,
image_path: null,
image_height: null,
button_link: '#',
date_add: '2024-10-27T12:18:40.000Z',
date_upd: '2024-10-27T12:18:40.000Z'
},
{
id_hero: 2,
title: 'Schlafzimmer',
description: 'Wir gestalten Badezimmer, die sowohl funktional als auch stilvoll sind.',
image_alt: null,
button_text: 'Mehr entdecken...',
locale: 'de',
display: 1,
text_position: 0,
title_color: '#a7a77c',
description_color: 'rgba(0, 0, 0, 0.8)',
background_color: '#1128da',
background_image_path: '/assets/images/logo/logo.png',
background_height: 700,
image_path: null,
image_height: null,
button_link: '#',
date_add: '2024-10-27T12:18:40.000Z',
date_upd: '2024-10-27T12:18:40.000Z'
}
]
};
return data[primaryColumnValue];
}

Params:

  • primaryColumnName: The primary unique column used in the table to identify the data (id or id_column... )