I'm only playing with B4J for WebApps for a only a couple of days and I love it! Sorry, just had to tell someone
I'm writing a framework to simplify creating WebApps with B4J for people without any HTML/CSS knowledge. One of the things I do is 'rewrite' the generated HTML when an action happens.
In my framework I would like to 'rewrite' whole blocks (containing buttons, text areas etc) using SetHTML. However, this HTML contains elements that are attached to B4J via JQueryElement. Although they have the same ID as the original on (e.g. only the color has changed), once I 'rewrite' the html, the connection with B4J seems to be lost. (e.g. the button_click is never been fired again. I've tried using ws.flush(), but that does not seem to help. The not rewritten elements keep working so the WebSocket is still active.
Attached is a simplified demo of what I'm talking about. I know in this case I could use SetProp() to change the color, but this is just to show the issue.
1. fill in two valid values in the top edit fields. click calculate: the result is in green
2. fill in invalid values in the top edit fields. click calculate: the result is in orange
3. do step 1 again and nothing happens
4. in the bottom edit fields (not rewritten), everything keeps working fine.
Note: I also tried 'resetting' the btnCalcb by adding this after maindiv2.SetHTML("...")
Dim btnCalcb As JQueryElement = ws.GetElementById("btncalcb")
or
Dim btnCalcb As JQueryElement = ws.GetElementBySelector("btncalcb")
but with no effect.
Probably something stupid I'm missing...