canSetItem = [self->item isValueSettable];
for (cnt = 0; cnt < goCount; cnt++) {
- id object = [array objectAtIndex:cnt];
+ NSString *pLabel, *sLabel;
+ id object;
+ object = [array objectAtIndex:cnt];
if (canSetIndex)
[self->index setUnsignedIntValue:cnt inComponent:sComponent];
if (canSetItem)
[self->item setValue:object inComponent:sComponent];
+
+ pLabel = [self->prefix stringValueInComponent:sComponent];
+ sLabel = [self->suffix stringValueInComponent:sComponent];
+ if (![pLabel isNotEmpty]) pLabel = nil; /* remove null/empty strings */
+ if (![sLabel isNotEmpty]) sLabel = nil; /* remove null/empty strings */
+
+ if (pLabel != nil || sLabel != nil)
+ WOResponse_AddCString(_response, "<label>");
+
+ if (pLabel != nil)
+ WOResponse_AddString(_response, pLabel);
- if (self->prefix != nil) {
- NSString *ps;
-
- ps = [self->prefix stringValueInComponent:sComponent];
- WOResponse_AddString(_response, ps);
- }
-
/* add checkbox */
{
- NSString *n, *label;
+ NSString *n;
- label = [self->suffix stringValueInComponent:sComponent];
- if (![label isNotEmpty]) label = nil; /* remove null/empty strings */
-
n = self->name != nil
? [self->name stringValueInComponent:sComponent]
: OWFormElementName(self, _ctx);
- if (label != nil)
- WOResponse_AddCString(_response, "<label>");
-
WOResponse_AddCString(_response, "<input type=\"checkbox\" name=\"");
[_response appendContentHTMLAttributeValue:n];
WOResponse_AddCString(_response, "\" value=\"");
n = [self->value stringValueInComponent:sComponent];
WOResponse_AddHtmlString(_response, n);
}
-
- if (label != nil) {
- WOResponse_AddString(_response, label);
- WOResponse_AddCString(_response, "</label>");
- }
}
+
+ if (sLabel != nil)
+ WOResponse_AddString(_response, sLabel);
+ if (pLabel != nil || sLabel != nil)
+ WOResponse_AddCString(_response, "<.label>");
[_ctx incrementLastElementIDComponent];
}