Error: Cannot read property 'children' of null

The error reads in full…

[quote]Could not execute returned javascript: Cannot read property ‘children’ of null
Source: Xojo.controls[‘Z5hhtNa8’].setValue(“MyPassword”);[/quote]

Occurs after the user accepts a login dialog by hitting their Return or Enter Key, and only when the web app is built and deployed to a Windows server. I am unable to reproduce it in debug mode on a mac. If the user uses the mouse to click the Ok button, no error.

“MyPassword” is the password that the user entered and it is used on only one line of my code where it is being encrypted and saved to a string…

Dim PW As String =  Encode(d.txtFld_Password.Text)

So the only time it is in plain english, ie. “MyPasswoerd”, is when it is entered into the field on the login dialog and where it is encrypted and saved to the string.

The error is thrown long after the login has completed. The user name and password have been passed to the database which has in turn validated the login and returned a successful logon to Xojo. Xojo has opened another web page and populated it from the data returned from the database and then and only then is the error thrown. One can see the new web page in the background.

Even though the alert says it cannot continue, the app continues to work just as if the error had not been thrown. So maybe the error is actualy being thrown from the original web page that displayed the dialog???

The error is not always thrown and seems to be more consistantly thrown the faster one hits the return key after entering the password, and it seems to happen almost exclusively with the Return key and not the Enter key. I can reduce the frequency of the error if I throw a delay into the mix after the return key is pressed.

I have tried a bunch of differnt things to figure this out but am stumped.

Thanks for any help.


The error is indicating that the control no longer exists when the command to set its text comes down from the server. Look in your code for a place that assigns txtFld_Password.Text to the value the user typed.

@Greg O’Lone Look in your code for a place that assigns txtFld_Password.Text to the value the user typed.

Thanks! you got me on the right track… Fixed.

I had forgotten about another text field, invisible, under txtFld_Password.Text called txtFld_PasswordPlainText.Text which I displayed when the user clicked a Plain Text check box. Both fields had a Textchanged event handler which copied their content to the other’s content to keep them in sink. I had to disable this feature a while back but instaed of disabling it in case I was asked to bring it back in the future, I just made the Plain Text check box invisible. After completely removing this feature, the plain text field and check box, the problem went away.

Curious how the Textchanged event fired after the Dialog closed. Remember that this only happened when the return or enter key was pressed while the cursor was still in the texrt field. The Keypressed event handler is in the page where the dialog is displayed and checks if the dialog property is nil before calling a validation method that closes the dialog and shows another page…

[code]if Details.KeyCode = 13 or Details.KeyCode = 3 then

if mw_Dialog <> nil then

elseif mw_ResetPW <> nil Then

end if
end if[/code]

I just now noticed that I was not properly setting the mw_Dialog property to nil after closing the dialog. Perhaps that created the problem, but I think that would only be the case if the user hit the return or enter key again. Also the problem went away before I discovered that I was not setting nil on the property properly.

In any event, I am good. Thanks.