View Javadoc
1   /*
2    * Copyright (c) 2002-2025 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 java.util.Collection;
18  
19  /**
20   * Interface for form fields where the original field name still matters even once it
21   * has been changed.
22   * <p>
23   * Example:<br>
24   * With<br>
25   * <code>&lt;input name="foo"/&gt;</code><br>
26   * following script will work<br>
27   * <code>
28   * theForm.foo.name = 'newName';<br>
29   * theForm.foo.value = 'some value';
30   * </code><br>
31   * Depending on the simulated browser the form field is reachable only through its original name
32   * or through all the names it has had.
33   * @author Marc Guillemot
34   * @author Ronald Brill
35   */
36  public interface FormFieldWithNameHistory {
37  
38      /**
39       * Gets the first value of the <code>name</code> attribute of this field before any change.
40       * @return the original name (which is the same as the current one when no change has been made)
41       */
42      String getOriginalName();
43  
44      /**
45       * Get all the names this field got after the original one.
46       * @return an empty collection if the name attribute has never been changed.
47       */
48      Collection<String> getNewNames();
49  }