I am not allowed to use Javascript . I have to change a CGI web firm HTML select control functions after a user choose an option,
Here is the source code:
def output_select(name,options
,fields):
print '<td><select id= "%s" name="%s" value = "selectvalue" class="Required" onchange="usgsChanged(this
);" >' % (name,name)
output_select_options(name
,options,f
ields);
print '</select></td>'
def output_select_options(name
,options,f
ields,rc=2
):
selected = fields.get(name,'')
selected = selected.strip()
if debug:
print "SELECTED " + selected
if len(fields) > 0 and 'phase' in fields: # and fields['phase'] == "1":
goforit = True
else:
goforit = False
for value,text in options:
if value==selected or text==selected:
bar = 'selected="selected"'
else:
bar = ""
print ' <option value="%s" %s>%s</option>' % \
(value,bar,text)
if rc == 2:
print '<script type="text/javascript">doc
ument.getE
lementById
(\'%s\').i
nnerHTML = "";</script>'% (name)
url = os.environ["REQUEST_URI"]
if debug:
print url
url = '
https://eecsappsrv.mit.edu/' + url
if debug:
print url
valuestr = urlparse(url).query
if goforit and len(valuestr) > 0:
fields[name] = urllib.unquote(valuestr)
output_select_options(name
,options,f
ields,1)
Please suggest to me how to replace the javascript with Python and HTML.
Thank you.
frankc123
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.