file.setHelp("Upload a file.");
if (error)
file.addError("This field is in error.");
// Select (single)
Select select = list.addItem().addSelect("select");
select.setLabel("Select (single)");
if (help)
select.setHelp("Select one of the options");
if (error)
select.addError("This field is in error.");
select.addOption("one","uno");
select.addOption("two","dos");
select.addOption("three","tres");
select.addOption("four","cuatro");
select.addOption("five","cinco");
select.setOptionSelected("one");
select = list.addItem().addSelect("multi-select");
select.setLabel("Select (multiple)");
select.setMultiple();
select.setSize(4);
if (help)
select.setHelp("Select one or more options");
if (error)
select.addError("This field is in error.");
select.addOption("one","uno");
select.addOption("two","dos");
select.addOption("three","tres");
select.addOption("four","cuatro");
select.addOption("five","cinco");
select.setOptionSelected("one");
select.setOptionSelected("three");
select.setOptionSelected("five");
// Non-Field-item
list.addLabel("Non-Field");
list.addItem().addContent("This is just text, not a field, but it has a list label.");
// Button
Button button = list.addItem().addButton("button");
button.setLabel("Button");
button.setValue("When you touch me I do things, lots of things");
if (help)
button.setHelp("Submit buttons allow the user to submit the form.");
if (error)
button.addError("This button is in error.");
// Non-field-unlabeled-item
list.addItem().addContent("The following fields are all various use cases of composites. Also note that this item is an item inside a list of type form that 1) does not contain a field and 2) does not have a label.");
// Composite
Composite composite = list.addItem().addComposite("composite-2text");
composite.setLabel("Composite (two text fields)");
if (help)
composite.setHelp("I am the help for the entire composite");
if (error)
composite.addError("Just the composite is in error");
text = composite.addText("partA");
text.setLabel("Part A");
text.setValue("Value for part A");
if (help)
text.setHelp("Part A");
text = composite.addText("partB");
text.setLabel("Part B");
text.setValue("Value for part B");
if (help)
text.setHelp("Part B");
// composite select & text fields
composite = list.addItem().addComposite("compositeB");
composite.setLabel("Composite (select & text fields)");
if (help)
composite.setHelp("This field is composed of a select and text field, select one and type the other.");
select = composite.addSelect("selectB");
select.setLabel("Numbers");
if (help)
select.setHelp("Me, me, me..... select me!");
if (error)
select.addError("The composite components are in error.");
select.addOption("one","uno");
select.addOption("two","dos");
select.addOption("three","tres");
select.addOption("four","cuatro");
select.addOption("five","cinco");
select.setOptionSelected("one");
text = composite.addText("TextB");
text.setLabel("Spanish Numbers");
if (help)
text.setHelp("Yay, yet another text field");
if (error)
text.addError("The composite components are in error.");
// Composite
composite = list.addItem().addComposite("composite-date");
composite.setLabel("Composite (date)");
if (help)
composite.setHelp("The data the item was published.");
if (error)
composite.addError("The date is in error.");
text = composite.addText("year");
text.setLabel("Year");
text.setSize(4,4);
if (help)
text.setHelp("year");
if (error)
text.addError("The year is in error");
select = composite.addSelect("month");
select.setLabel("Month");
if (error)
select.addError("The month is in error");
if (help)
text.setHelp("month");
select.addOption("","(Select Month)");
select.addOption(1,"January");
select.addOption(2,"Feburary");
select.addOption(3,"March");
select.addOption(4,"April");
select.addOption(5,"May");
select.addOption(6,"June");
select.addOption(7,"July");
select.addOption(8,"August");
select.addOption(9,"September");
select.addOption(10,"August");
select.addOption(11,"October");
select.addOption(12,"November");
select.addOption(13,"December");
text = composite.addText("day");
text.setLabel("Day");
if (help)
text.setHelp("day");