mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 18:45:10 +01:00
form fixes
This commit is contained in:
parent
716d71c833
commit
b741f069ce
@ -87,12 +87,15 @@ void TimeFieldCellRenderer::writeCellProperties(const TimeFieldCell* pCell, std:
|
||||
static const std::string fmt24h("'H:i'");
|
||||
static const std::string fmt24hs("'H:i:s'");
|
||||
static const std::string fmtAmPms("'h:i:s A'");
|
||||
static const std::string fmt12h("'h:i'");
|
||||
if (fmt == TimeField::FMT_24H)
|
||||
ostr << ",format:" << fmt24h;
|
||||
else if (fmt == TimeField::FMT_24H_WITHSECONDS)
|
||||
ostr << ",format:" << fmt24hs;
|
||||
else if (fmt == TimeField::FMT_AMPM_WITHSECONDS)
|
||||
ostr << ",format:" << fmtAmPms;
|
||||
else if (fmt == TimeField::FMT_12H)
|
||||
ostr << ",format:" << fmt12h << ",minValue:'00:00', maxValue:'11:59'";
|
||||
else
|
||||
; // this is the default
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
enum Format
|
||||
{
|
||||
FMT_AMPM = 0,
|
||||
FMT_12H,
|
||||
FMT_24H,
|
||||
FMT_AMPM_WITHSECONDS,
|
||||
FMT_24H_WITHSECONDS
|
||||
|
@ -90,14 +90,43 @@ void RequestHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::
|
||||
Poco::Net::HTMLForm form(request, request.stream());
|
||||
if (!form.empty())
|
||||
{
|
||||
handleForm(form);
|
||||
try
|
||||
{
|
||||
handleForm(form);
|
||||
Poco::Net::NameValueCollection::ConstIterator it = form.find(Form::FORM_ID);
|
||||
if (it != form.end())
|
||||
{
|
||||
_pApp->notifySubmitButton(Poco::NumberParser::parse(it->second));
|
||||
}
|
||||
response.send();
|
||||
}
|
||||
catch(WebWidgetsException& e)
|
||||
{
|
||||
Poco::Net::HTTPResponse::HTTPStatus code = Poco::Net::HTTPResponse::HTTP_BAD_REQUEST;
|
||||
if (e.code() > code && e.code() <= Poco::Net::HTTPResponse::HTTP_EXPECTATION_FAILED)
|
||||
code = (Poco::Net::HTTPResponse::HTTPStatus)e.code();
|
||||
response.setStatusAndReason(code, e.displayText());
|
||||
response.send();
|
||||
}
|
||||
catch(Poco::Exception& e)
|
||||
{
|
||||
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, e.displayText());
|
||||
response.send();
|
||||
}
|
||||
catch(std::exception& e)
|
||||
{
|
||||
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, e.what());
|
||||
response.send();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, "Unknown exception");
|
||||
response.send();
|
||||
}
|
||||
|
||||
}
|
||||
Poco::Net::NameValueCollection::ConstIterator it = form.find(Form::FORM_ID);
|
||||
if (it != form.end())
|
||||
{
|
||||
_pApp->notifySubmitButton(Poco::NumberParser::parse(it->second));
|
||||
}
|
||||
handlePageRequest(request, response);
|
||||
else
|
||||
handlePageRequest(request, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -70,6 +70,8 @@ void TimeFieldCell::setFormat(TimeField::Format fmt)
|
||||
_format = "%h:%M:%S %A";
|
||||
else if (_fmt == TimeField::FMT_24H_WITHSECONDS)
|
||||
_format = "%H:%M:%S";
|
||||
else if (_fmt == TimeField::FMT_12H)
|
||||
_format = "%H:%M";
|
||||
setFormatter(new DateFormatter(_format));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user