WebCheckBox weird behavior

Hi all,

This code in the Mouse up event of the WebCheckBox doesn’t seem to always work properly.

Select Case details.Button Case details.LeftMouseButton if me.Value then TA_Status.AppendText "True" else TA_Status.AppendText "False" end if End Select

I have 5 checkboxes, all with the code above. When I checked them all during run I get FalseFalseFalseFalseFalse in the TA_Status text area. I then quit Firefox and started a fresh run and this time when i checked them all I get TrueTrueTrueTrueTrue - which I believe is correct.

Just for fun i started unchecking them and got TrueFalseTrueTrueTrue - Something is wrong here. i did a search before I posted and didn’t see anything like this anywhere and just spent all day narrowing my code down to what you see above.

2014 Release 2

Use the ValueChanged event instead of MouseDown. The behavior you’re seeing is a result of events not arriving at the server in the order the client generates them.

Then what’s the best way to keep value change from executing when you need to set the value before hand? I mean that if my user has a list of items and selects one, I need to set the check box value to true, so the user can make it false. I don’t want any code to fire until the user actually clicks the check box.
In the desktop applications I have always used Mouse Up.

Keep a property, “privUpdating as boolean” in the page. When you programmatically set values, set privUpdating = true before, privUpdating = false when you’re done updating. In a control’s ValueChanged (or equivalent), check that privUpdating is false to determine that it’s a user action.

There are a lot of tricks like this in the sample project that comes with Studio Stable Web Essentials.

Ok, thanks for the advice. Kind of new to Web Addition.