Last updated at 3:06 pm UTC on 29 October 2018
HVHtmlBuilder objects build HTML pages and handle HTML Forms.
A HVHtmlBuilder object has a back reference to the HVHttpView that created it (for various services) and to the request of that view.
Typical use is
1. to instantiate a HVHtmlBuilder object (a HVHttpView has a method #builder which creates one),
2. feed it "build messages" and
3. then finally call #render which will stream out the resulting HTML page.
builder := self builder. "1"
builder h1: 'A heading'.
builder inputText: #name
During the build some of the "build messages" return objects that can be used for input and output - typically objects representing
- Submit buttons
The messages #postForm, #inputText: and #submit all returned objects in the code above but the code chose to ignore them.
The #contents message causes the builder to assemble the finished HTML document and return it as a String.
Normally you just return the builder itself since its class HVHtmlBuilder also implements #asHttpResponseTo: which means that it can fed as a result to Comanche/KomHttpServer from an 'url' method in a HVHttpView object.
So you do not need to call #render and actually, in order to compose pages from multiple methods it is better if you do not call #render.
elements - An OrderedCollection holding all elements that constitute the page.
elementStack - An OrderedCollection acting as a stack for certain elements like for example forms.
Another example: HVSimpleForms method megaform2