Issues Adding Text to UDInputField Switch in New-UDInput

Greetings! This may be an easy to solve issue but I couldn’t find any examples documenting what I’m trying to solve, but I’m creating a report that allows the end user to select different options for the report. When I use New-UDInput-Field -Type switch, I can’t get any explanatory text to display next to the control. It will display the on/off values I supply to the control, but that’s it. Here’s a screenshot of the page:

Screenshot

And here’s the code for the page:

    $EmployeeDetailReportPage = New-UDPage -Name "Employee Details Report" -Title "IT Dashboard - Employee Details Report" -AuthorizationPolicy "Basic Policy", "Admin Policy" -Content {
        

        New-UDRow {
            New-UDColumn -LargeSize 6 -Content {
                $SwitchesControlValues = @("Yes", "No")
                $DefaultSwitchControlValue = "No"

                New-UDInput  -Id "PropertiesSelectionForm" -Title "Select the parameters for the report" -Content {
                    New-UDInputField -Type switch -Name IncludeWorkStudy -Placeholder $SwitchesControlValues
                    New-UDInputField -Type switch -Name IncludeTemporary -Placeholder $SwitchesControlValues
                    New-UDInputField -Type switch -Name IncludeContractor -Placeholder $SwitchesControlValues
                    New-UDInputField -Type switch -Name IncludeDECEP -Placeholder $SwitchesControlValues
                } -Endpoint {
                    param($IncludeWorkStudy, $IncludeTemporary, $IncludeContractor, $IncludeDECEP)
                    
                }
            }
            New-UDColumn -LargeSize 6 -Content{}
        }
        New-UDRow {}

    }

I’ve even tried using New-UDElement -tag “p” -Content {“some content”} to create a label and wasn’t able to make anything show up. Also, I’m on version 2.9.0 Enterprise of UD. (Edit: moved to this post to the UD Help subform.)

Hello @Andrew.Wells and thanks for posting the question…the component has a demonstration here:- https://poshud.com/New-UDSwitch you have the OnText and OffText parameters…I believe there is the tooltip component to add information for what a control is for you could look to implement that for mouse over if you need to explain the control more…or just split the input in-half as the column you are nesting it in and put information on the other side other the column…my 2 pence worth anyways :crazy_face:

@psDevUK

I’ve been testing similar things while waiting for input on this question. New-UDSwitch is awesome, but I’m still curious if New-UDInputField -Type Switch will can an generate/include explanatory label other than Yes/No or On/Off.

Dude, as this software is so flexible, you could look at implementing your own switch component to meet your requirements…https://www.npmjs.com/package/react-switch

@Andrew.Wells just to confirm you can use what-ever label text you want on this control:-

New-UDSwitch -Id "Switch" -OnText "Fix Problems" -OffText "Dont Fix"

Think the problem is you are nesting this component inside New-UDInput (which auto produces the submit button) if you used the component on it’s own then specified the parameters I mentioned in my previous post you will see the text can say whatever you want it to say…then all you need to do is give each of these switch components a unique ID then create a New-UDButton which then grabs the selected value off of each switch via the ID element on it. Hope this now fully answers the question…? :crazy_face:

Yes! I definitely can using that cmdlet. And I think I misstated my original point. I had been looking to see if New-UDInput created explanatory labels over and above the custom on/off values, like in the screenshot below where I created labels and used New-UDSwitch.

Screenshot2

Since it looks like New-UDInput doesn’t generate the labels like in the screenshot, I’m just going to keep on with the other methods I’ve been using. Thank you for your help!