Hi. So I continue learning Wt and I'm onto the forms. I'm looking at the
FormModel.cpp.
Originally I was doing it the old, manual way. But I had several problems. One
was it was just so hard to produce a "normal" looking form. If we refer the
the" Create New User" form example, I observe that all the labels are right
aligned and the forms fields are the same length. In my own manual trials, I
got something that was either too small, or took up the whole width after the
label. How do I properly control the form field width. For example, I want to
add a "middle initial" WLineEdit field of length 1, and sized appropriately.
How would I do that? As well as making the last name and MI on the same line as
first name.
Next, its just way too verbose. 360 lines for 7 form fields? When I was working
in PHP I came up with a form class that used a simple layout template which the
forms field objects were rendered into. This looked something like this (pseudo
code):
form = Form(template)
//Form::addItem(FormField ff);
//FormField::FormField(formFieldName, labelContent, placeHodlerText,
formInputWidget, validationFunction, dataModel);
FormLineEdit("firstName", "First name", "enter your first name", new
WLineEdit(), validatorNotBlank(), sourceModel(session()).user(), "firstName"))
form.addItem(FormLineEdit("firstName", "First name", "enter your first name",
new WLineEdit(), validatorNotBlank(), sourceModel(session()).user(),
"firstName"))
form.addItem(FormLineEdit("lastName", "Last name", "enter your last name", new
WLineEdit(), validatorNotBlank(), sourceModel(session()).user(), "lastName"))
form.show();
I'm hoping we could do something similar?
Also, I rue C++11. (Rant: This is because I am historically an embedded
developer. Our compilers lag behind standards by 10 years or so and though
C++11 is very cool and a good thing, and we'll eventually get support for it, I
rather code be provided that runs on legacy compilers. Let those people that
have C++11 compilers change it to C++11. But in the meantime, we are fracturing
the C++ code base, which is a very wrong thing to do since the main attraction
to anyone still using C++ these days is that it runs everywhere... End rant)
Can we get a version that does not use C++11?
Thanks.
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest