Problem update field in another form ..

Problem update field in another form ..

Hi,
i have a form without store data. I insert password and populate other two record (Cognome e Nome) with data in table Piloti.

With this script inserted in On click event button:

if (count(Piloti[PASSWORD == input.Password])  ==  0)
{
    alert("Pilot not found");
}
else
{
    rec  =  Piloti  [PASSWORD == input.Password];
    rec.status = "Confirmed";
}

i need to update field status in table piloti. But when i click this is the error come:

Error details:
Error occured while executing on click script.
Unable to update data on the form variable null
Error occured


Why?

Thanks for all