Variable in Page URL not allowing further pages to load

What i want is to build webpages that have the same variable and root URL, but have it load a different page with different functionality on each. However, in my example below any link is just loading /Debug/:id and ignoring the rest of the URL. Is this expected behavior? Or a bug?

image
image
image

$Pages = @()
$Pages += New-UDPage -Name 'Debug' -Content {
    New-UDForm -Content {
        New-UDTextbox -Id 'txtID' -Label 'ID'
    } -OnValidate {
        If ($Eventdata.txtID -eq '') {
            New-UDFormValidationResult -ValidationError "ID can't be blank"
        }
        else {
            New-UDFormValidationResult -Valid
        }
    } -OnSubmit {
        Invoke-UDRedirect -Url "/Debug/$($EventData.txtID)"
    }
} 
$Pages += New-UDPage -Name 'Debug ID' -Url '/Debug/:id' -Content {
    New-UDTypography $ID
    New-UDButton -text "Test After ID" -OnClick {
        Invoke-UDRedirect "Debug/$ID/Test" -OpenInNewWindow
    }
    New-UDButton -text "Test Before ID" -OnClick {
        Invoke-UDRedirect "Debug/Test/$ID" -OpenInNewWindow
    }
}
$Pages += New-UDPage -Name 'Debug ID TEST' -Url '/Debug/:id/Test' -Content {
    New-UDTypography "$ID Test"
}
$Pages += New-UDPage -Name 'Debug ID TEST' -Url '/Debug/Test/:id' -Content {
    New-UDTypography "Test $ID"
}
New-UDDashboard -Title 'PowerShell Universal' -Pages $Pages
Product: PowerShell Universal
Version: 3.3.4

You’ll just want to reorder the pages. The routing goes through the list of pages and matches the first one found. Since the /Debug/:id route matches all of the other routes, it will also end up first.

I think this will do what you want.

$Pages = @()
$Pages += New-UDPage -Name 'Debug' -Content {
    New-UDForm -Content {
        New-UDTextbox -Id 'txtID' -Label 'ID'
    } -OnValidate {
        If ($Eventdata.txtID -eq '') {
            New-UDFormValidationResult -ValidationError "ID can't be blank"
        }
        else {
            New-UDFormValidationResult -Valid
        }
    } -OnSubmit {
        Invoke-UDRedirect -Url "/Debug/$($EventData.txtID)"
    }
} 

$Pages += New-UDPage -Name 'Debug ID TEST' -Url '/Debug/Test/:id' -Content {
    New-UDTypography "Test $ID"
}
$Pages += New-UDPage -Name 'Debug ID TEST' -Url '/Debug/:id/Test' -Content {
    New-UDTypography "$ID Test"
}
$Pages += New-UDPage -Name 'Debug ID' -Url '/Debug/:id' -Content {
    New-UDTypography $ID
    New-UDButton -text "Test After ID" -OnClick {
        Invoke-UDRedirect "Debug/$ID/Test" -OpenInNewWindow
    }
    New-UDButton -text "Test Before ID" -OnClick {
        Invoke-UDRedirect "Debug/Test/$ID" -OpenInNewWindow
    }
}
New-UDDashboard -Title 'PowerShell Universal' -Pages $Pages

That worked! And in retrospect makes a lot of sense. Thanks :slight_smile: