CaddyShack

I asked Dalai Lama the most important question that I think you could ask –if he had ever seen Caddyshack.
-Jesse Ventura

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public class FormUtils {

private FormUtils() {
}

public static String createAnswers(FormField formField,HttpServletRequest request) {
final StringBuffer builder = new StringBuffer();
if (formField.getType().equals(FormField.TYPE_TEXT_SINGLE)) {
String cookieValue = getCookieValueForField(formField.getVariable(),request);
String insertValue = "";
if(ModelUtil.hasLength(cookieValue)){
insertValue = "value=\""+cookieValue+"\"";
}
builder.append("<input name="\"""type="\"text\"" />");
}
else if (formField.getType().equals(FormField.TYPE_TEXT_MULTI)){
builder.append("
<textarea cols="\"30\"" rows="\"3\"" name="\""">");<br /> builder.append("</textarea>");
}
else if (formField.getType().equals(FormField.TYPE_LIST_SINGLE)) {
builder.append("<select name="\"""><option value="\""">" + option.getLabel() + "</option</select>");
}
else if (formField.getType().equals(FormField.TYPE_BOOLEAN)) {
Iterator iter = formField.getOptions();
int counter = 0;
while (iter.hasNext()) {
FormField.Option option = (FormField.Option)iter.next();
String value = option.getLabel();
builder.append("<input name="\"""type="\"checkbox\"" value="\"""/>");
builder.append(" ");
builder.append(value);
builder.append("");

counter++;
}
}
If you enjoyed this post,make sure you subscribe to my RSS feed!

1 comment to CaddyShack

Leave a Reply

  

  

  

You can use these HTML tags

<a href=""title=""><abbr title=""><acronym title=""><b><blockquote cite=""><cite><code><del datetime=""><em><i><q cite=""><strike><strong><pre lang=""line=""escaped=""highlight="">