Fields are empty after entering data on a Windows Server

I have a strange problem.
My application has a Popup Menu with dates (LongDate format) and the RowTag is filled with the dates in SQLDate format.

In the SelectionChanged event, I use ListIndex to fill a field with the selected date.

// Fill globalShowdate with selected date 
App.globalShowdate = pmDate.RowTag (pmDate.ListIndex)

When I run the program in debug mode, ListIndex is working as supposed, 0 for the 1st select date, 1 for the 2nd selected date, …
It turns out that when the same program is run on the Windows server, when I select a date ListIndex is always -1.
Am I doing something wrong or is this a bug?

It’s getting more and more weird.
On the Windows Server, every (text)field I enter data is empty after losing the focus. :frowning:
The screen shows the text entered, but the field itself is empty.
When running in debug mode, there are no problems.

I made a small test-application
A webpage with a textfield, a label displaying the text of the textfield and a message box showing the text of the textfield

On the (customers) Windows server no text is shown in the label and the message box.

In debug mode text is shown in the label and in the message box.

Than I tried it on the my website’s Linux server, text is shown in the label and in the message box.

I also tried older releases of Xojo (2015r1) but the result is still the same.
For now I have no clue why this isn’t working on the Windows server.

Because Windows.

Joking aside, if the Windows server meets the system requirements you should try to recreate the problem in a test project. If you can reproduce the problem, create a bug report.

Thank you Tim.
The screen prints are from a test project.
Next step for me is to contact the customer’s provider to find out the exact version of the Windows server.

<https://xojo.com/issue/42309>

Very frustrating.
Not a single person at Xojo has even looked at <https://xojo.com/issue/42309>.

Now I’m not able to deliver the software to the customer.
The reservation system for the upcoming performances doesn’t work and my customer is not happy at all.
That makes two, because I’m not happy at all too!
:frowning:

[quote]every (text)field I enter data is empty after losing the focus. :frowning:
The screen shows the text entered, but the field itself is empty.[/quote]

This may be way off but…

Do you have Implicit Instantiation turned on in the project?

There is a small chance that what you are seeing is data entered on one copy of a window, while you are interrogating the automatically created default copy.

If you create a window like this:

dim w as new Window1
w.show

then you need to refer to that window as w in future

If any of your code ALSO refers to Window1, then you have two windows on the go
Window1 will be full of empty text boxes and listboxes with listindex = -1 etc, while w contains the actual data.

I only have 1 window and that window is set as DefaultWepPage in App.

In my test program I fill a label with the entered text in the TextChanged event of the Text Field.

lbltestfield.Text = testfield.Text

This works fine in Debug run mode and also on the Linux server where my website is hosted.
On the Windows server where the website of my customer is hosted, the text is shown on the screen, but the field itself is really empty during/after entering text.

p.s.
Changed the title of this thread because it is more than just a problem with ListIndex.

Have you tried any different action?
Like a push button that set the labelText?

The app is CGI or exe?
If CGI maybe the server don’t “serve” the reply from your app

As a workaround, you can set a javascript on the TextField LostFocus that get the content of the Dom element, and send that back to your app.

Self.ExecuteJavaScript("window.location.replace('#'+document.getElementById('"+me.ControlID+"').getElementsByTagName('input')[0].value);")

You catch the content in Session.HashTagChanged in HashTag.

If you have several TextFields, you can do

Self.ExecuteJavaScript("window.location.replace('#"+me.name+";'+document.getElementById('"+me.ControlID+"').getElementsByTagName('input')[0].value);")

Then you get in Hashtag the name of the TextField, followed by a semicolon, then the content of Text. Use a split on “;” and cycle through the WebPage controls to set each text property.

Instead of Hashtag you can use a WebSDK control Xojo.TriggerServerEvent, but that is beyond the scope of a single post.

[quote=245282:@Antonio Rinaldi]The app is CGI or exe?
[/quote]
It’s CGI.
I’ve tried exe, but that didn’t run at all.

[quote=245282:@Antonio Rinaldi]Have you tried any different action?
Like a push button that set the labelText?
[/quote]
It’s not about filling the labeltext, it’s about entering data in a text field that, when moving to another field, is always empty.

Paul, try my workaround. It should solve your issue.

There are a lot of (editable) fields on the official webpage.
The white background is information about the upcoming performance.
The grey background contains editable textfields and popupmenu’s for the reservation.

OK. I wanted to make sure. It appears the TextFields here on a build with 2015R4 under Windows 10 do not present the issue you report.

In LostFocus, I set a label text, and that works just fine.

Sub LostFocus() Label1.Text = me.text End Sub

In case that was nevertheless an issue with WebTextField, try changing the super to WebTextArea. It could work better.

I did that and the resulting control behaves fine.

I am starting to suspect something in your code. Could be your use of SelectionChange.

@Michel Bujardet,
The program works fine in debug mode, under OS X, Windows 10 and on a Linux server (where my website is hosted).
As soon as I put the program on the Windows server, where the website of my customer is hosted, the fields (popupmenu’s, text field, text areas) are always empty after selection/entering data.
To me that indicates that the problem has nothing to do with my code.
It’s the combination of Xojo and Windows server that creates this weird behavior.

Indeed.

Windows server mysteries abound.

Being pragmatic, you need a way to deal with that before if and when Xojo fixes that. At the earliest 2016R1, for all we know end of March.

I got another idea. I need to test a thing or two before I share it.

BTW : Have you tried changing the super to TextArea ? With some luck, the bug won’t manifest.

Otherwise, here is another idea that I just tested, although I could not reproduce the bug that seems to be specific to the particular version of Windows server.

Apparently, the wipe happens upon LostFocus. So up until then, Text behaves normally.

I tried creating a myTextField subclass, with

Sub TextChanged() if me.text <> "" then myText = me.text end if RaiseEvent TextChanged End Sub

I added an event definition TextChanged so the instances keep that event.

myText is a string property of myTextField

Sub LostFocus() me.text = mytext RaiseEvent LostFocus End Sub

The way it works is by setting aside the content of Text while it exists in myText, and reinstate it in LostFocus as it had disappeared.

Not being able to reproduce the issue, I do not know the exact moment at which the Text property is wiped. If it is after LostFocus took place, you could maintain a flag like hasFocus set in GotFocus and LostFocus, and do

if hasfocus  then

Changing the super for TextField from WebTextField to myTextField should alleviate the issue. You can easily do that with search replace for all the TextFields at once.

Tried that, but the result is the same. Field is empty on Windows server.

I am not entirely surprised. Underneath it is an tag.

You may want to try the Text property caching.

Otherwise, JavaScript can be applied within a WebSDK custom control, but that becomes real involved.