public interface AQForm
The logical representation of the form is a table, where each cell may contain
zero, one, or more components added via this class addXX() methods. This object
produces HTML code by calling its toHtml()
method.
This class can be used to generate straightforward HTML table (without a <form> tag).
Simply skip setAction(String, String, String)
call.
Example:
if(aqua.request.getParameter("login") != null) { // handling the form output aqua.response.write("Welcome, " + aqua.request.getParameter("name") + "<br>"); aqua.response.writeLink("Logout", aqua.request.getRequestURI()); } else { // present the form var f = aqua.form.newForm(3,2); f.setAction("", "get", ""); f.setStyle("width:100%; background:#dddddd;"); f.add(0,0,"Name:"); f.addTextField(0,1, "name", ""); f.add(1,0,"Password:"); f.addPasswordField(1,1, "password"); f.addSubmitButton(2,1,"login","Login"); f.addHiddenField("hidden", "a secret"); aqua.response.write(f); }
Modifier and Type | Method and Description |
---|---|
void |
add(int row,
int col,
Object x)
This method inserts an object's html presentation into the specified location.
|
void |
addHiddenField(String name,
String value)
Inserts a hidden field into the specified location.
|
void |
addInput(int row,
int column,
String type,
String name,
String value)
Inserts an input field into the specified location.
|
void |
addLink(int row,
int col,
String text,
String url)
This method inserts a hyperlink into the specified location.
|
void |
addPasswordField(int row,
int col,
String name)
This method inserts a password field into the specified location.
|
AQFormSelector |
addSelectorField(int row,
int col,
String name)
This method inserts a selector field into the specified location.
|
void |
addSubmitButton(int row,
int col,
String name,
String text)
This method inserts a Submit button into the specified location.
|
AQTextArea |
addTextArea(int row,
int column,
int textRows,
int textColumns)
This method iseerts a TEXTAREA field into a form location specified by (row,col).
|
void |
addTextField(int row,
int col,
String name,
String text)
This method inserts a text field into the specified location.
|
void |
clear()
Clear the form.
|
void |
clearCell(int row,
int column)
Remove cell content.
|
String |
getStyle()
Returns the form style.
|
void |
setAction(String action,
String method,
String name)
Sets form action parameters.
|
void |
setCellStyle(int row,
int col,
String style)
Sets individual cell style.
|
void |
setFooter(String footer,
String style)
Sets the form footer.
|
void |
setHeader(String header,
String style)
Sets the form header.
|
void |
setStyle(String style)
Sets the form style.
|
String |
toHtml()
Generates html code.
|
void setAction(String action, String method, String name)
action
- The URL of to send the form output to.method
- HTTP request method. Example: GET.name
- The form name.void add(int row, int col, Object x)
row
- Row index, 0-based.col
- Column index, 0-based.x
- Object to be added to the cell.void addLink(int row, int col, String text, String url)
row
- Row index, 0-based.col
- Column index, 0-based.text
- The text which will be presented to the user.url
- Link's URL.void addTextField(int row, int col, String name, String text)
row
- Row index, 0-based.col
- Column index, 0-based.name
- Field name.text
- Initial field value.void addPasswordField(int row, int col, String name)
row
- Row index, 0-based.col
- Column index, 0-based.name
- Field name.void addSubmitButton(int row, int col, String name, String text)
row
- Row index, 0-based.col
- Column index, 0-based.name
- Field name.text
- Initial field value.void addInput(int row, int column, String type, String name, String value)
row
- Row index, 0-based.column
- Column index, 0-based.type
- The input type.name
- Field name.value
- Initial field value.void addHiddenField(String name, String value)
name
- Field name.value
- Initial field value.void clearCell(int row, int column)
row
- Row index, 0-based.column
- Column index, 0-based.void clear()
void setStyle(String style)
style
- Valid HTML style specification. Example: "background:#E0E0E0; width:100%;"String getStyle()
void setCellStyle(int row, int col, String style)
row
- Cell row index.col
- Cell column index.style
- HTML style of the cell TD element.AQFormSelector addSelectorField(int row, int col, String name)
row
- Row index, 0-based.col
- Column index, 0-based.name
- Field name.AQFormSelector
AQTextArea addTextArea(int row, int column, int textRows, int textColumns)
row
- Form row index, 0-based.column
- Form column index, 0-based.textRows
- Number of rows in the text area.textColumns
- Number of columns in the text area.AQTextArea
void setHeader(String header, String style)
header
- Header text.style
- Valid HTML style specification. Example: "background:#E0E0E0; width:100%;"void setFooter(String footer, String style)
footer
- Footer text.style
- Valid HTML style specification. Example: "background:#E0E0E0; width:100%;"String toHtml()
Copyright © 2017 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.