1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.wotonomy.web;
20
21 import net.wotonomy.foundation.NSDictionary;
22 import net.wotonomy.foundation.NSMutableArray;
23
24 /***
25 * Implements a submit button with dynamic bindings.
26 * @author michael@mpowers.net
27 * @author $Author: cgruber $
28 * @version $Revision: 905 $
29 */
30 public class WOSubmitButton extends WOInput {
31
32 public WOSubmitButton() {
33 super();
34 }
35
36 public WOSubmitButton(String n, NSDictionary m, WOElement t) {
37 super(n, m, t);
38 }
39
40 protected String inputType() {
41 return "SUBMIT";
42 }
43
44 protected Object value(WOContext c) {
45 Object v = valueForProperty("value", c.component());
46 if (v == null) {
47 return "Submit";
48 }
49 return v;
50 }
51
52 protected NSMutableArray additionalAttributes() {
53 NSMutableArray a = super.additionalAttributes();
54 a.add("action");
55 return a;
56 }
57
58 public WOActionResults invokeAction(WORequest r, WOContext c) {
59 if (disabled(c))
60 return null;
61
62
63 if (r.formValueForKey(inputName(c)) != null) {
64 if (associations.objectForKey("action") != null)
65 return (WOActionResults)valueForProperty("action", c.component());
66 }
67 return null;
68 }
69
70 }