Click
Click Examples

Source Viewer : WEB-INF/classes/org/apache/click/examples/page/control/EmailForm.java

package org.apache.click.examples.page.control;

import org.apache.click.control.Form;
import org.apache.click.control.Submit;
import org.apache.click.control.TextField;
import org.apache.click.examples.control.RichTextArea;
import org.apache.click.examples.page.BorderPage;
import org.apache.click.examples.page.HomePage;
import org.apache.click.extras.control.EmailField;
import org.apache.click.extras.control.PageSubmit;

/**
 * Provides an example page using the custom RichTextArea control.
 *
 * @see RichTextArea
 */
public class EmailForm extends BorderPage {

    private static final long serialVersionUID = 1L;

    private Form form = new Form("form");

    public EmailForm() {
        addControl(form);

        form.setLabelsPosition(Form.POSITION_TOP);
        form.setErrorsPosition(Form.POSITION_TOP);

        EmailField addressField = new EmailField("address", "To:");
        addressField.setRequired(true);
        addressField.setSize(60);
        form.add(addressField);

        TextField subjectField = new TextField("subject", "Subject:");
        subjectField.setRequired(true);
        subjectField.setSize(60);
        form.add(subjectField);

        RichTextArea messageTextArea = new RichTextArea("message");
        messageTextArea.setLabel("Message:");
        messageTextArea.setCols(45);
        messageTextArea.setRows(8);
        form.add(messageTextArea);

        form.add(new Submit("send", "  Send "));
        form.add(new PageSubmit("cancel", HomePage.class));
    }

}