Inputtext in table does not know the current row $_

When i add button to the object it works great but when i add input textbox it edit the last row always

any one know how to make the inputbox aware of the $_ (current row)

New-UDTable -Title "" -Headers ("Name" , "User Name","Title", "Employee Number","IPphone","Change IPphone") -Endpoint {
Get-ADUser -Filter * -Properties displayname,samaccountname,title,sapid,IPphone -ResultSetSize 30 |
Where {$_.sapid -ne $null -and $_.title -ne $null}|
foreach{
[PSCustomObject]@{
                    Name =$_.displayname
                    UserName=$_.Samaccountname
                    Title=$_.title
                    EmpID=$_.sapid
                    IPphone =$_.IPphone
                    Change =     New-UDInput -Title "" -Id "Form" -Content {
                        New-UDInputField -Type 'textbox' -Name 'IpPhone' -Placeholder 'IpPhone' } -Endpoint {
                        param($IpPhone)
                        if ($IpPhone -ne $null){SET-ADUSER $_ -replace @{ ipPhone = $IpPhone } }

                                } 
                }   
}|
Out-UDTableData -Property ("Name","UserName","Title","EmpID","IPphone","Change")} -AutoRefresh -RefreshInterval 10

Hi @alaaelmahdy thanks for posting your question. I seen no-one else has got back to you yet regarding this. I haven’t tested the code you are using, but after reading what you want to achieve have you read the following web-page?


I have used these techiques to achieve what I believe you are after.

Dear @psDevUK

Thank you for replying , i actually did the same with buttons and it got through but when i use the input boxes it doesn’t.

Thanks