Skip to content

Two-step Subform #989

Answered by lemuelvdm
w3star asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, I hope this guide helps you set up the two-level subform structure like in the Demo 5 component (Countries → States → Cities). Below is a simplified breakdown of how to structure both set and get operations to make everything work seamlessly.


✅ Step 1: Define the SET Map

The setMap tells the system how to link and save data from the subforms.

$setMap =  [
	'_core' => [ // Parent subform: States
		'table' => 'state',         // Table storing parent subform data
		'indexKey' => 'guid',       // Unique ID field for states
		'linkKey' => 'country',     // Field linking state to country
		'linkValue' => $data['guid'] ?? '' // Current country GUID
	],
	'cities' => [ // Child subform: Ci…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by lemuelvdm
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants