1 /*
2 * Copyright (c) 2002-2026 Gargoyle Software Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * https://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 package org.htmlunit.html;
16
17 import org.htmlunit.util.NameValuePair;
18
19 /**
20 * An element that can have it's values sent to the server during a form submit.
21 *
22 * @author Mike Bowler
23 * @author Daniel Gredler
24 * @author Ronald Brill
25 */
26 public interface SubmittableElement {
27
28 /**
29 * <p>Returns an array of {@link NameValuePair}s that are the values that will be sent
30 * back to the server whenever this element's containing form is submitted.</p>
31 *
32 * <p>THIS METHOD IS INTENDED FOR THE USE OF THE FRAMEWORK ONLY AND SHOULD NOT
33 * BE USED BY CONSUMERS OF HTMLUNIT. USE AT YOUR OWN RISK.</p>
34 *
35 * @return the values that will be sent back to the server whenever this element's
36 * containing form is submitted
37 */
38 NameValuePair[] getSubmitNameValuePairs();
39
40 /**
41 * Returns the value of this element to the default value or checked state (usually what it was at
42 * the time the page was loaded, unless it has been modified via JavaScript).
43 */
44 void reset();
45
46 /**
47 * Sets the default value to use when this element gets reset, if applicable.
48 * @param defaultValue the default value to use when this element gets reset, if applicable
49 */
50 void setDefaultValue(String defaultValue);
51
52 /**
53 * Returns the default value to use when this element gets reset, if applicable.
54 * @return the default value to use when this element gets reset, if applicable
55 */
56 String getDefaultValue();
57
58 /**
59 * Sets the default checked state to use when this element gets reset, if applicable.
60 * The default implementation is empty; only checkboxes and radio buttons
61 * really care what the default checked value is.
62 * @see SubmittableElement#setDefaultChecked(boolean)
63 * @see HtmlRadioButtonInput#setDefaultChecked(boolean)
64 * @see HtmlCheckBoxInput#setDefaultChecked(boolean)
65 *
66 * @param defaultChecked the default checked state to use when this element gets reset, if applicable
67 */
68 void setDefaultChecked(boolean defaultChecked);
69
70 /**
71 * Returns the default checked state to use when this element gets reset, if applicable.
72 * @return the default checked state to use when this element gets reset, if applicable
73 */
74 boolean isDefaultChecked();
75
76 }