2
# File Name: HTMLFormElement.py
4
# Documentation: http://docs.4suite.com/4DOM/HTMLFormElement.py.html
7
WWW: http://4suite.com/4DOM e-mail: support@4suite.com
9
Copyright (c) 2000 Fourthought Inc, USA. All Rights Reserved.
10
See http://4suite.com/COPYRIGHT for license and copyright information
14
from xml.dom import ext
15
from xml.dom import implementation
16
from xml.dom.html.HTMLElement import HTMLElement
17
from xml.dom.html.HTMLCollection import HTMLCollection
19
FORM_CHILDREN = ['INPUT',
32
class HTMLFormElement(HTMLElement):
34
def __init__(self, ownerDocument, nodeName='FORM'):
35
HTMLElement.__init__(self, ownerDocument, nodeName)
37
### Attribute Methods ###
39
def _get_acceptCharset(self):
40
return self.getAttribute('ACCEPT-CHARSET')
42
def _set_acceptCharset(self,acceptcharset):
43
self.setAttribute('ACCEPT-CHARSET',acceptcharset)
45
def _get_action(self):
46
return self.getAttribute('ACTION')
48
def _set_action(self,action):
49
self.setAttribute('ACTION',action)
51
def _get_elements(self):
52
#Make a collection of control elements
53
nl = self.getElementsByTagName('*')
56
if child.tagName in FORM_CHILDREN:
58
return implementation._4dom_createHTMLCollection(l)
60
def _get_encType(self):
61
return self.getAttribute('ENCTYPE')
63
def _set_encType(self,enctype):
64
self.setAttribute('ENCTYPE',enctype)
66
def _get_length(self):
67
return self._get_elements().length
69
def _get_method(self):
70
return string.capitalize(self.getAttribute('METHOD'))
72
def _set_method(self,method):
73
self.setAttribute('METHOD',method)
76
return self.getAttribute('NAME')
78
def _set_name(self,name):
79
self.setAttribute('NAME',name)
81
def _get_target(self):
82
return self.getAttribute('TARGET')
84
def _set_target(self,target):
85
self.setAttribute('TARGET',target)
95
### Attribute Access Mappings ###
97
_readComputedAttrs = HTMLElement._readComputedAttrs.copy()
98
_readComputedAttrs.update ({
99
'acceptCharset' : _get_acceptCharset,
100
'action' : _get_action,
101
'elements' : _get_elements,
102
'encType' : _get_encType,
103
'length' : _get_length,
104
'method' : _get_method,
106
'target' : _get_target
109
_writeComputedAttrs = HTMLElement._writeComputedAttrs.copy()
110
_writeComputedAttrs.update ({
111
'acceptCharset' : _set_acceptCharset,
112
'action' : _set_action,
113
'encType' : _set_encType,
114
'method' : _set_method,
116
'target' : _set_target
119
_readOnlyAttrs = filter(lambda k,m=_writeComputedAttrs: not m.has_key(k),
120
HTMLElement._readOnlyAttrs + _readComputedAttrs.keys())