Discussion:
[Wt-interest] Unwanted Page Refresh Try 2
Aaron Laws
2015-08-20 21:41:28 UTC
Permalink
I created a minimum working example of what I'm talking about, and it's
attached. It actually compiles and runs!

Although it's 135 lines, I had to get a web server and DBO up and going.
Really, it's *remarkable* that it's so short and in C++! Anyway, when I
click the pushbutton created on line 124, it looks like the session.find on
line 112 is causing the page to refresh. I'm not sure why a Wt::Dbo call
would cause the page to reload? Or would cause the browser to issue a new
GET.

Any ideas? Thanks, all!

In Christ,
Aaron Laws
In this code: http://pastie.org/10347062, when I uncomment line 36 and
click the new ingredient button, the page refreshes, and I'm not sure why.
When I comment line 36, no refresh. Of course, the ingredient isn't added
to the dbo collection, but the GUI element shows up on the page, etc.
Is there anything about getting a non-const pointer to an object, and
adding something to a Wt::Dbo::collection on that object that would cause a
page to refresh? It has me a bit frazzled. Let me know if you have any
other questions.
In Christ,
Aaron Laws
Koen Deforche
2015-08-21 06:30:28 UTC
Permalink
Hey,

When, during event handling, an uncaught exception is thrown, then Wt
will print out the exception and terminate the session.
The next request from the browser will then trigger a new session to
be created, causing in a page refresh.

In your case, the exception that is being thrown is most likely an
exception from Wt::Dbo that you don't have an active transaction while
you are interacting with the database.

Regards,
koen
Post by Aaron Laws
I created a minimum working example of what I'm talking about, and it's
attached. It actually compiles and runs!
Although it's 135 lines, I had to get a web server and DBO up and going.
Really, it's *remarkable* that it's so short and in C++! Anyway, when I
click the pushbutton created on line 124, it looks like the session.find on
line 112 is causing the page to refresh. I'm not sure why a Wt::Dbo call
would cause the page to reload? Or would cause the browser to issue a new
GET.
Any ideas? Thanks, all!
In Christ,
Aaron Laws
In this code: http://pastie.org/10347062, when I uncomment line 36 and
click the new ingredient button, the page refreshes, and I'm not sure why.
When I comment line 36, no refresh. Of course, the ingredient isn't added to
the dbo collection, but the GUI element shows up on the page, etc.
Is there anything about getting a non-const pointer to an object, and
adding something to a Wt::Dbo::collection on that object that would cause a
page to refresh? It has me a bit frazzled. Let me know if you have any other
questions.
In Christ,
Aaron Laws
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
Aaron Laws
2015-08-22 00:20:03 UTC
Permalink
Post by Koen Deforche
In your case, the exception that is being thrown is most likely an
exception from Wt::Dbo that you don't have an active transaction while
you are interacting with the database.
Regards,
koen
Oh wow...I've been working on this for a while, and I know that I need a
transaction to work with the database...I should have known better, but
you're right!

hanging head in shame

Thank you

Aaron

Loading...