i am writing a script to create some doc on my website,
im using stepper that consist of 3 steps,
- name of doc,
- template to clone,
- which i face problem has 2 field email and role(editor-viewer)
New-UDStep -OnLoad {
New-UDStack -Content {
# New-UDElement -tag 'div' -Content { "Previous data: $Body" }
New-UDStack -Content {
New-UDElement -tag 'div' -Content { "Enter your email" }
New-UDTextbox -Id 'email' -Value $EventData.Context.email
} -Direction column
New-UDStack -Content {
New-UDElement -tag 'div' -Content { "Enter your role" }
New-UDSelect -Id "role"-Option {
New-UDSelectOption -Name 'viewer' -Value 'viewers'
New-UDSelectOption -Name 'editor' -Value 'editors'
} -DefaultValue 'editors'
} -Direction column
} -Spacing 2 -Direction column
} -Label "Step 3"
how can i make this step dynamic where to (+) button on click to add those 2 fields again and (-) button to delete specific user this button appears at every user info if we have 2 at least.
if someone knows how to do it or if it’s possible
$users = @()
$addFieldButton = New-UDButton -Text "Add User" -OnClick {
$newStack = New-UDStack -Content {
New-UDElement -tag 'div' -Content "Enter your email"
New-UDTextbox -Id ("email" + ($users.Count + 1))
} -Direction column
$newStack += New-UDStack -Content {
New-UDElement -tag 'div' -Content "Enter your role"
New-UDSelect -Id ("role" + ($users.Count + 1))
-Option {
New-UDSelectOption -Name 'viewer' -Value 'viewers'
New-UDSelectOption -Name 'editor' -Value 'editors'
}
-DefaultValue 'editors'
} -Direction column
}
i tried this but i don’t know how to append it