Project

General

Profile

Bug #2425 ยป main.cpp

minimal Wt app to reproduce issue - Will Johnson, 11/15/2013 08:38 PM

 
#include <iostream>

#include <Wt/WText>
#include <Wt/WSpinBox>
#include <Wt/WApplication>
#include <Wt/WContainerWidget>


class MinimalWtApp : public Wt::WApplication
{
public:
MinimalWtApp(const Wt::WEnvironment& env)
: Wt::WApplication(env)
{
std::cout << "Creating MinimalWtApp" << sessionId() << std::endl;
setTitle("MinimalWtApp");
Wt::WText *txt = new Wt::WText( "There will be a javascript exception while"
" loading page, due to calling "
"setObjectName(...) for a WAbstractSpinBox",
domRoot() );
txt->setInline( false );
Wt::WSpinBox *sb = new Wt::WSpinBox();
//A call in javascript like the following will be created
// Wt3_3_1.setValidationState(Wt3_3_1.$('opsry94'),1,'',1);
// however 'opsry94' wont exist in the DOM, only 'MySpinBox_opsry94' will.
// There will also be a call in the JS to:
// Wt3_3_1.setValidationState(Wt3_3_1.$('MySpinBox_opsry94'),1,'',1);
// which I believe is correct.
//
sb->setObjectName( "MySpinBox" );
domRoot()->addWidget( sb );
std::cout << "WSpinBox id is '" << sb->id() << "'" << std::endl;
}

virtual ~MinimalWtApp()
{
std::cout << "Destructing MinimalWtApp " << sessionId() << std::endl;
}
private:

};


Wt::WApplication *createApplication(const Wt::WEnvironment& env)
{
return new MinimalWtApp(env);
}

int main(int argc, char **argv)
{
return WRun(argc, argv, &createApplication);
}

    (1-1/1)