001 
002 /*
003  *  JScripter Standard 1.0 - To Script In Java
004  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
005  *  
006  *  This program is free software: you can redistribute it and/or modify
007  *  it under the terms of the GNU Affero General Public License as published by
008  *  the Free Software Foundation, either version 3 of the License, or
009  *  (at your option) any later version.
010  *  
011  *  This program is distributed in the hope that it will be useful,
012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014  *  GNU Affero General Public License for more details.
015  *  
016  *  You should have received a copy of the GNU Affero General Public License
017  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
018  */
019 
020 package js.user;
021 
022 import js.*;
023 import js.core.*;
024 
025 /**
026  * <p>An <b>opaque</b> class representing JavaScript client-side objects of the global 
027  * {@link JsClient#HTMLFormElement} class.</p>
028  * <p>This class represents a form 
029  * in an HTML page, or a {@link JsHTMLElement} object created with the HTML 
030  * <tt>&lt;form&gt;</tt> tag.</p> 
031  *
032  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
033  *
034  * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be
035  * generated into the target codes. Re-compilers must exit with error on the operations of
036  * accessing that kind of class objects.
037  * The <tt>checkcast</tt> operation to the class literal of this interface must be ignored
038  * and <tt>instanceof</tt> to it always <tt>true</tt>.
039  */
040 public class JsHTMLFormElement extends JsClient.HTMLFormElement.Prototype
041 {
042     /**
043      * <p>An <b>internal</b> class containing membership data for its enclosing
044      * opaque class.</p>
045      * <p>This class is only used inside of <b>opaque</b> or <b>internal</b> classes or
046      * class members.</p>
047      *
048      * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
049      * 
050      * @javascript Re-compilers must report error on resolving an <b>internal</b> class.
051      */
052     protected static abstract class Members extends JsClient.HTMLFormElement.Prototype.Members
053     {
054         /**
055          * <p>An <b>internal</b> static field defining a member ID of the field name and
056          * used internally to define a member of the same name.</p>
057          * @since 1.0
058          * @see JsHTMLFormElement#elements
059          * @see JsHTMLFormElement.Member#elements
060          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
061          */
062         public final static Mid elements      = id("elements"     );
063         /**
064          * <p>An <b>internal</b> static field defining a member ID of the field name and
065          * used internally to define a member of the same name.</p>
066          * @since 1.0
067          * @see JsHTMLFormElement#length
068          * @see JsHTMLFormElement.Member#length
069          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
070          */
071         public final static Mid length        = id("length"       );
072         /**
073          * <p>An <b>internal</b> static field defining a member ID of the field name and
074          * used internally to define a member of the same name.</p>
075          * @since 1.0
076          * @see JsHTMLFormElement#acceptCharset
077          * @see JsHTMLFormElement.Member#acceptCharset
078          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
079          */
080         public final static Mid acceptCharset = id("acceptCharset");
081         /**
082          * <p>An <b>internal</b> static field defining a member ID of the field name and
083          * used internally to define a member of the same name.</p>
084          * @since 1.0
085          * @see JsHTMLFormElement#action
086          * @see JsHTMLFormElement.Member#action
087          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
088          */
089         public final static Mid action        = id("action"       );
090         /**
091          * <p>An <b>internal</b> static field defining a member ID of the field name and
092          * used internally to define a member of the same name.</p>
093          * @since 1.0
094          * @see JsHTMLFormElement#enctype
095          * @see JsHTMLFormElement.Member#enctype
096          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
097          */
098         public final static Mid enctype       = id("enctype"      );
099         /**
100          * <p>An <b>internal</b> static field defining a member ID of the field name and
101          * used internally to define a member of the same name.</p>
102          * @since 1.0
103          * @see JsHTMLFormElement#method
104          * @see JsHTMLFormElement.Member#method
105          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
106          */
107         public final static Mid method        = id("method"       );
108         /**
109          * <p>An <b>internal</b> static field defining a member ID of the field name and
110          * used internally to define a member of the same name.</p>
111          * @since 1.0
112          * @see JsHTMLFormElement#name
113          * @see JsHTMLFormElement.Member#name
114          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
115          */
116         public final static Mid name          = id("name"         );
117         /**
118          * <p>An <b>internal</b> static field defining a member ID of the field name and
119          * used internally to define a member of the same name.</p>
120          * @since 1.0
121          * @see JsHTMLFormElement#target
122          * @see JsHTMLFormElement.Member#target
123          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
124          */
125         public final static Mid target        = id("target"       );
126         /**
127          * <p>An <b>internal</b> static field defining a member ID of the field name and
128          * used internally to define a member of the same name.</p>
129          * @since 1.0
130          * @see JsHTMLFormElement#onreset
131          * @see JsHTMLFormElement.Member#onreset
132          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
133          */
134         public final static Mid onreset       = id("onreset"      );
135         /**
136          * <p>An <b>internal</b> static field defining a member ID of the field name and
137          * used internally to define a member of the same name.</p>
138          * @since 1.0
139          * @see JsHTMLFormElement#onsubmit
140          * @see JsHTMLFormElement.Member#onsubmit
141          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
142          */
143         public final static Mid onsubmit      = id("onsubmit"     );
144     }
145 
146     /**
147      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
148      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
149      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
150      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
151      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
152      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
153      * either circumstance, the field names must be exactly same as the member names, as 
154      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
155      * based on the field names.</p>
156      *
157      * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
158      * 
159      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
160      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
161      * of class objects.
162      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
163      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
164      * <pre>q.m</pre>
165      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
166      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
167      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
168      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
169      * <pre>m</pre>
170      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
171      * error on the access to <b>opaque</b> fields declared by this class under any other 
172      * circumstances.
173      */
174     public static class Member extends JsClient.HTMLFormElement.Prototype.Member
175     {
176         /**
177          * <p>Internally constructs a member based on a qualifying member.</p>
178          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
179          * or <b>internal</b> classes or class members.</p>
180          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
181          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
182          * declared in the declaring class of this constructor itself or its subclasses. 
183          * Under this circumstance, the field names must be exactly same as the member 
184          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
185          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
186          * to their names appending to the name resolved from the specified qualifying 
187          * member with a dot in between.</p>
188          * @param q A qualifying member
189          * @param mid The ID of the member to construct
190          * @since 1.0
191          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
192          */
193         public Member(JsObject.Member q, Mid mid) {
194             super(q, mid);
195         }
196         /**
197          * <p>Internally constructs a member without a qualifying member.</p>
198          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
199          * or <b>internal</b> classes or class members.</p>
200          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
201          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
202          * declared in <b>opaque</b> types other than the declaring class of this constructor 
203          * itself and its subclasses. Under this circumstance, the field names must be
204          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
205          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
206          * @param mid The ID of the member to construct
207          * @since 1.0
208          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
209          */
210         public Member(Mid mid) {
211             super(mid);
212         }
213         @Override
214         /**
215          * <p>Evaluates the property, represented by the current member instance, of the
216          * argument object.</p>
217          * @param o The argument object
218          * @return The value of the current member based on the object argument.
219          * @since 1.0
220          * @javascript Re-compilers must convert the instance invocation of this method into
221          * the JavaScript expression: 
222          * <pre>o.m</pre>
223          * where <tt>m</tt> is the identifier name resolved from the current member
224          * instance of the invocation.
225          */
226         public JsHTMLFormElement with(ObjectLike o) {
227             return new JsHTMLFormElement(super.with(o));
228         }
229 
230         /**
231          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
232          * name of this field, qualified by the current member instance of the field, and 
233          * to access the property of the name on an object.</p>
234          * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
235          * object is a read-only reference to an array of form elements, such as objects 
236          * of {@link JsHTMLInputElement}, {@link JsHTMLSelectElement} or {@link JsHTMLTextAreaElement}, 
237          * that appear in the HTML form. The elements of the array are in the same order 
238          * they appear in the HTML source code for the form.</p>
239          * @since 1.0
240          * @javascript Re-compilers must resolve the member of this instance field to the
241          * identifier of the field name appending to the identifier resolved from its 
242          * qualifying member with a dot in between.
243          */
244         public final JsHTMLCollection.Member<?> elements = new JsHTMLCollection.Member<JsHTMLElement>(this, Members.elements);
245         /**
246          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
247          * name of this field, qualified by the current member instance of the field, and 
248          * to access the property of the name on an object.</p>
249          * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
250          * object refers to a read-only integer value specifying the number of form 
251          * controls in the form, which is the same value as the length of {@link #elements}.</p> 
252          * @since 1.0
253          * @see JsHTMLFormElement#length()
254          * @javascript Re-compilers must resolve the member of this instance field to the
255          * identifier of the field name appending to the identifier resolved from its 
256          * qualifying member with a dot in between.
257          */
258         public final Value.Number.Member length        = new Value.Number.Member(this, Members.length       );
259         /**
260          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
261          * name of this field, qualified by the current member instance of the field, and 
262          * to access the property of the name on an object.</p>
263          * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
264          * object refers to a string specifying a list of character sets supported 
265          * by the server.</p>
266          * @since 1.0
267          * @javascript Re-compilers must resolve the member of this instance field to the
268          * identifier of the field name appending to the identifier resolved from its 
269          * qualifying member with a dot in between.
270          */
271         public final Value.String.Member acceptCharset = new Value.String.Member(this, Members.acceptCharset);
272         /**
273          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
274          * name of this field, qualified by the current member instance of the field, and 
275          * to access the property of the name on an object.</p>
276          * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
277          * object refers to a string specifying the URL of the server-side form handler.</p>
278          * @since 1.0
279          * @see #onsubmit
280          * @see JsHTMLFormElement#submit()
281          * @javascript Re-compilers must resolve the member of this instance field to the
282          * identifier of the field name appending to the identifier resolved from its 
283          * qualifying member with a dot in between.
284          */
285         public final Value.String.Member action        = new Value.String.Member(this, Members.action       );
286         /**
287          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
288          * name of this field, qualified by the current member instance of the field, and 
289          * to access the property of the name on an object.</p>
290          * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
291          * object refers to a string specifying the encoding of the form which is the 
292          * content type of the submitted form, generally "application/x-www-form-urlencoded".</p>
293          * @since 1.0
294          * @javascript Re-compilers must resolve the member of this instance field to the
295          * identifier of the field name appending to the identifier resolved from its 
296          * qualifying member with a dot in between.
297          */
298         public final Value.String.Member enctype       = new Value.String.Member(this, Members.enctype      );
299         /**
300          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
301          * name of this field, qualified by the current member instance of the field, and 
302          * to access the property of the name on an object.</p>
303          * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
304          * object refers to a string specifying the HTTP method used for form submission.</p>
305          * @since 1.0
306          * @javascript Re-compilers must resolve the member of this instance field to the
307          * identifier of the field name appending to the identifier resolved from its 
308          * qualifying member with a dot in between.
309          */
310         public final Value.String.Member method        = new Value.String.Member(this, Members.method       );
311         /**
312          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
313          * name of this field, qualified by the current member instance of the field, and 
314          * to access the property of the name on an object.</p>
315          * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
316          * object refers to a string specifying the URL of the form handler.</p>
317          * @since 1.0
318          * @javascript Re-compilers must resolve the member of this instance field to the
319          * identifier of the field name appending to the identifier resolved from its 
320          * qualifying member with a dot in between.
321          */
322         public final Value.String.Member name          = new Value.String.Member(this, Members.name         );
323         /**
324          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
325          * name of this field, qualified by the current member instance of the field, and 
326          * to access the property of the name on an object.</p>
327          * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
328          * object refers to string specifying the {@link JsHTMLFrameElement#name} of a 
329          * target frame to render the resource in.</p>
330          * @since 1.0
331          * @javascript Re-compilers must resolve the member of this instance field to the
332          * identifier of the field name appending to the identifier resolved from its 
333          * qualifying member with a dot in between.
334          */
335         public final Value.String.Member target        = new Value.String.Member(this, Members.target       );
336         /**
337          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
338          * name of this field, qualified by the current member instance of the field, and 
339          * to access the property of the name on an object.</p>
340          * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
341          * object is a reference to an event handler function invoked just before the 
342          * elements of the form are reset when the user clicks on a {@link JsHTMLResetElement} 
343          * button in the form. Note that this handler is not invoked in response to the 
344          * {@link JsHTMLFormElement#reset()} method. If this handler returns <tt>false</tt>, 
345          * the elements of the form are not reset. See {@link JsElement#addEventListener(String, JsFunction, Boolean)} 
346          * for another way to register event handlers.</p> 
347          * @since 1.0
348          * @see JsHTMLFormElement#reset()
349          * @see JsElement#addEventListener(String, JsFunction, Boolean)
350          * @see JsElement#attachEvent(String, JsFunction)
351          * @javascript Re-compilers must resolve the member of this instance field to the
352          * identifier of the field name appending to the identifier resolved from its 
353          * qualifying member with a dot in between.
354          */
355         public final JsFunction.Member<?> onreset  = new JsFunction.Member<Object>(this, Members.onreset );
356         /**
357          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
358          * name of this field, qualified by the current member instance of the field, and 
359          * to access the property of the name on an object.</p>
360          * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
361          * object is a reference to an event handler function invoked just before the form 
362          * is submitted when the user clicks on a {@link JsHTMLSubmitElement} button in 
363          * the form. It allows form entries to be validated before being submitted. Note 
364          * that this handler is not invoked in response to the {@link JsHTMLFormElement#submit()} 
365          * method. If it returns <tt>false</tt>, the elements of the form are not submitted. 
366          * If it returns any other value or returns nothing, the form is submitted normally. 
367          * Because this handler can cancel form submission, it is ideal for performing 
368          * form data validation. See {@link JsElement#addEventListener(String, JsFunction, Boolean)} 
369          * for another way to register event handlers.</p> 
370          * @since 1.0
371          * @see JsElement#addEventListener(String, JsFunction, Boolean)
372          * @see JsElement#attachEvent(String, JsFunction)
373          * @see JsHTMLFormElement#submit()
374          * @javascript Re-compilers must resolve the member of this instance field to the
375          * identifier of the field name appending to the identifier resolved from its 
376          * qualifying member with a dot in between.
377          */
378         public final JsFunction.Member<?> onsubmit = new JsFunction.Member<Object>(this, Members.onsubmit);
379     }
380 
381     /**
382      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it
383      * with the wrapping constructor.</p>
384      * @param var The argument of an <b>opaque</b> object.
385      * @since 1.0
386      * @javascript Re-compilers must ignore the construction operation of this constructor,
387      * that is, replacing it with its only argument.
388      */
389     public JsHTMLFormElement(JsObject var) {
390         super(var);
391     }
392 
393     /**
394      * <p>An <b>opaque</b> static field defining a member that is named by the field name
395      * without a qualifying member and to access the property of the name on an object.</p>
396      * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
397      * object is a read-only reference to an array of form elements, such as objects 
398      * of {@link JsHTMLInputElement}, {@link JsHTMLSelectElement} or {@link JsHTMLTextAreaElement}, 
399      * that appear in the HTML form. The elements of the array are in the same order 
400      * they appear in the HTML source code for the form.</p>
401      * @since 1.0
402      * @javascript Re-compilers must resolve the member of this static field to the
403      * identifier of the field name.
404      */
405     public static final JsHTMLCollection.Member<?> elements = new JsHTMLCollection.Member<JsHTMLElement>(Members.elements);
406     /**
407      * <p>An <b>opaque</b> static field defining a member that is named by the field name
408      * without a qualifying member and to access the property of the name on an object.</p>
409      * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
410      * object refers to a read-only integer value specifying the number of form 
411      * controls in the form, which is the same value as the length of {@link #elements}.</p> 
412      * @since 1.0
413      * @see #length()
414      * @javascript Re-compilers must resolve the member of this static field to the
415      * identifier of the field name.
416      */
417     public static final Value.Number.Member length        = new Value.Number.Member(Members.length       );
418     /**
419      * <p>An <b>opaque</b> static field defining a member that is named by the field name
420      * without a qualifying member and to access the property of the name on an object.</p>
421      * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
422      * object refers to a string specifying a list of character sets supported 
423      * by the server.</p>
424      * @since 1.0
425      * @javascript Re-compilers must resolve the member of this static field to the
426      * identifier of the field name.
427      */
428     public static final Value.String.Member acceptCharset = new Value.String.Member(Members.acceptCharset);
429     /**
430      * <p>An <b>opaque</b> static field defining a member that is named by the field name
431      * without a qualifying member and to access the property of the name on an object.</p>
432      * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
433      * object refers to a string specifying the URL of the server-side form handler.</p>
434      * @since 1.0
435      * @see #onsubmit
436      * @see #submit()
437      * @javascript Re-compilers must resolve the member of this static field to the
438      * identifier of the field name.
439      */
440     public static final Value.String.Member action        = new Value.String.Member(Members.action       );
441     /**
442      * <p>An <b>opaque</b> static field defining a member that is named by the field name
443      * without a qualifying member and to access the property of the name on an object.</p>
444      * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
445      * object refers to a string specifying the encoding of the form which is the 
446      * content type of the submitted form, generally "application/x-www-form-urlencoded".</p>
447      * @since 1.0
448      * @javascript Re-compilers must resolve the member of this static field to the
449      * identifier of the field name.
450      */
451     public static final Value.String.Member enctype       = new Value.String.Member(Members.enctype      );
452     /**
453      * <p>An <b>opaque</b> static field defining a member that is named by the field name
454      * without a qualifying member and to access the property of the name on an object.</p>
455      * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
456      * object refers to a string specifying the HTTP method used for form submission.</p>
457      * @since 1.0
458      * @javascript Re-compilers must resolve the member of this static field to the
459      * identifier of the field name.
460      */
461     public static final Value.String.Member method        = new Value.String.Member(Members.method       );
462     /**
463      * <p>An <b>opaque</b> static field defining a member that is named by the field name
464      * without a qualifying member and to access the property of the name on an object.</p>
465      * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
466      * object refers to a string specifying the URL of the form handler.</p>
467      * @since 1.0
468      * @javascript Re-compilers must resolve the member of this static field to the
469      * identifier of the field name.
470      */
471     public static final Value.String.Member name          = new Value.String.Member(Members.name         );
472     /**
473      * <p>An <b>opaque</b> static field defining a member that is named by the field name
474      * without a qualifying member and to access the property of the name on an object.</p>
475      * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
476      * object refers to string specifying the {@link JsHTMLFrameElement#name} of a 
477      * target frame to render the resource in.</p>
478      * @since 1.0
479      * @javascript Re-compilers must resolve the member of this static field to the
480      * identifier of the field name.
481      */
482     public static final Value.String.Member target        = new Value.String.Member(Members.target       );
483     /**
484      * <p>An <b>opaque</b> static field defining a member that is named by the field name
485      * without a qualifying member and to access the property of the name on an object.</p>
486      * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
487      * object is a reference to an event handler function invoked just before the 
488      * elements of the form are reset when the user clicks on a {@link JsHTMLResetElement} 
489      * button in the form. Note that this handler is not invoked in response to the 
490      * {@link #reset()} method. If this handler returns <tt>false</tt>, 
491      * the elements of the form are not reset. See {@link JsElement#addEventListener(String, JsFunction, Boolean)} 
492      * for another way to register event handlers.</p> 
493      * @since 1.0
494      * @see #reset()
495      * @see JsElement#addEventListener(String, JsFunction, Boolean)
496      * @see JsElement#attachEvent(String, JsFunction)
497      * @javascript Re-compilers must resolve the member of this static field to the
498      * identifier of the field name.
499      */
500     public static final JsFunction.Member<?> onreset  = new JsFunction.Member<Object>(Members.onreset );
501     /**
502      * <p>An <b>opaque</b> static field defining a member that is named by the field name
503      * without a qualifying member and to access the property of the name on an object.</p>
504      * <p>The property, identified by this member, of a {@link JsHTMLFormElement} 
505      * object is a reference to an event handler function invoked just before the form 
506      * is submitted when the user clicks on a {@link JsHTMLSubmitElement} button in 
507      * the form. It allows form entries to be validated before being submitted. Note 
508      * that this handler is not invoked in response to the {@link #submit()} 
509      * method. If it returns <tt>false</tt>, the elements of the form are not submitted. 
510      * If it returns any other value or returns nothing, the form is submitted normally. 
511      * Because this handler can cancel form submission, it is ideal for performing 
512      * form data validation. See {@link JsElement#addEventListener(String, JsFunction, Boolean)} 
513      * for another way to register event handlers.</p> 
514      * @since 1.0
515      * @see #submit()
516      * @see JsElement#addEventListener(String, JsFunction, Boolean)
517      * @see JsElement#attachEvent(String, JsFunction)
518      * @javascript Re-compilers must resolve the member of this static field to the
519      * identifier of the field name.
520      */
521     public static final JsFunction.Member<?> onsubmit = new JsFunction.Member<Object>(Members.onsubmit);
522 
523     @Override
524     /**
525      * <p>Returns the primitive value associated with the current instance, if there is one.
526      * This invocation simply returns the instance itself for the current instance is an 
527      * object and there is no primitive value for it.</p>
528      * @return The current object itself.
529      * @since 1.0
530      * @javascript Re-compilers must convert the instance invocation of this method directly
531      * into a JavaScript invocation on its current object instance without changing the 
532      * method name, but expanding variable arguments, if any, into comma-separated values. 
533      */
534     public JsHTMLFormElement valueOf() {
535         return new JsHTMLFormElement((JsObject)var().valueOf());
536     }
537 
538     /**
539      * <p>Returns The number of form elements in the form, which is the same value as 
540      * the length of {@link #elements}.</p>
541      * @return The number of form elements in the form.
542      * @since 1.0
543      * @javascript Re-compilers must convert the instance invocation of this method directly
544      * into a JavaScript invocation on its current object instance without changing the 
545      * method name, but expanding variable arguments, if any, into comma-separated values. 
546      */
547     public int length() {
548         return length.with(this).intValue();
549     }
550     /**
551      * <p>Resets all form elements to their default values.</p>
552      * <p>This method resets each element of the current form to its default value. The 
553      * results of calling it are like the results of a user clicking on a {@link JsHTMLResetElement} 
554      * button, except that the {@link #onreset} event handler of the form is not invoked.</p>
555      * @since 1.0
556      * @see #onreset
557      * @see #submit()
558      * @javascript Re-compilers must convert the instance invocation of this method directly
559      * into a JavaScript invocation on its current object instance without changing the 
560      * method name, but expanding variable arguments, if any, into comma-separated values. 
561      */
562     public void reset() {
563         call(reset);
564     }
565     /**
566      * <p>Submits the form to a web server.</p>
567      * <p>This method submits the values of the form elements to the server specified 
568      * by the form's {@link #action} property. It submits a form in the same way that a 
569      * user's clicking on a {@link JsHTMLResetElement} button, except that the {@link #onsubmit} 
570      * event handler of the form is not invoked.</p>
571      * @since 1.0
572      * @see #onsubmit
573      * @see #reset()
574      * @javascript Re-compilers must convert the instance invocation of this method directly
575      * into a JavaScript invocation on its current object instance without changing the 
576      * method name, but expanding variable arguments, if any, into comma-separated values. 
577      */
578     public void submit() {
579         call(submit);
580     }
581 }