[Zope] EVENT HANDLING PROBLEM EXPLAINED
prabuddha ray
buddha_2001 at rediffmail.com
Fri Mar 4 00:23:52 EST 2005
jonathan sir ,
thanks for that detailed solution. but i guess my problem was
simpler. i cudnt explain it properly .
below is the code for the html page generated by C_login.asp .
I've to rebuilt this page in zope and as u'll see i've alraedy
the
javascript functionality that u've mentioned in 3rd soln.
but the javascript is not at all being executed in zope.
it will obviously give error asa u select some district coz
the original asp is not there.
Ne We this is wat i wanted : as soon
as i select a district the the corresponding user list in next
combobox sud appear.the data are being fetched from Mysql using
the ZSQL queries.
AND CAN WE ANYWAY USE JAVASCRIPT IN DTML DOCUMENTS.
please tell me the soln in ZOPE.
CODE c_login.asp.html
"
<link REL="stylesheet" TYPE="text/css"
HREF="_Themes/expeditn/THEME.CSS" VI6.0THEME="Expedition">
<link REL="stylesheet" TYPE="text/css"
HREF="_Themes/expeditn/GRAPH0.CSS" VI6.0THEME="Expedition">
<link REL="stylesheet" TYPE="text/css"
HREF="_Themes/expeditn/COLOR0.CSS" VI6.0THEME="Expedition">
<link REL="stylesheet" TYPE="text/css"
HREF="_Themes/expeditn/CUSTOM.CSS"
VI6.0THEME="Expedition"></head>
<body bgColor=darkseagreen bottomMargin=0 topMargin=0><font
face=Arial color=darkblue ><strong>
<center><strong><font color=white face=tahoma ><font
face=Arial><strong><font
color=firebrick>Government of
India<br></font><font color=gold><font
color=black>Ministry
of
Communication & Information Technology</font>
<br></font>
<font color=darkgreen>Department of Information
Technology<br></font></strong></font></font></strong></center>
<center><strong><font face=tahoma color=black >National
Informatics Center</font></strong></center>
<center><strong><font face=tahoma
color=royalblue>JHARKAND STATE UNIT</font></strong></center>
<center><strong><font color=black
>JHARKAND</font></strong></center>
</strong></font>
<hr style="COLOR: black"></body></html>
<html>
<head>
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</head>
<body bgColor=LightSteelBlue onload="foc()">
<script language="javascript">
function sub_click(){
document.nlogin.login.value='y'
document.nlogin.action='c_nlogged.asp'
document.nlogin.method='post'
document.nlogin.submit()
}
function res(){
document.nlogin.districtname.selectedIndex=0
document.nlogin.username.selectedIndex=0
document.nlogin.password1.value=''
document.nlogin.districtname.focus()
}
function foc(){
if (document.nlogin.invalid.value==1){
document.nlogin.districtname.focus()
return false
}
if (document.nlogin.user11.value=='y'){
document.nlogin.username.focus()
return false
}
document.nlogin.districtname.focus()
}
function user10(){
document.nlogin.user11.value='y'
document.nlogin.action='c_login.asp'
document.nlogin.method='post'
document.nlogin.submit()
}
</script>
<form name="nlogin" method="post" action="c_nlogged.asp">
<input name=invalid type=hidden value="">
<input name=login type=hidden value="y">
<input name=user11 type=hidden>
<center>
<center><font face=arial color=darkred size=5><b>System
Management Group</font>
<br><br><br>
<center><font face=arial color=darkblue size=4>Logon Screen for
NIC Officers - <font
color=red>Consumables(Tech)</font><br><br></font>
<table border=1 cellspacing=1 bordercolor="darkblue"
cellpadding=4
align=center>
<tr>
<td align=left>
<font face=arial color=darkgreen size=3><b>District
Name
</font></td></font>
<td align=left>
<select name=districtname style="HEIGHT: 22px; WIDTH:
185px"
onchange="user10()">
<option value="" selected>
<option value="01">Bokaro
<option value="02">Chatra
<option value="03">Deoghar
<option value="04">Dhanbad
<option value="05">Dumka
<option value="06">East Singhbhum
<option value="07">Garwah
<option value="08">Giridih
<option value="09">Godda
<option value="10">Gumla
<option value="11">Jamtara
<option value="99">JHARKAND
<option value="12">Koderma
<option value="13">Latehar
<option value="14">Lohardagga
<option value="15">Pakur
<option value="16">Palamu
<option value="18">Ranchi
<option value="19">Sahibganj
<option value="20">Seraikela
<option value="21">Simdega
<option value="22">West Singhbhum
</select>
</td>
</tr>
<tr>
<td align=left>
<font face=arial color=darkgreen
size=3><strong>User
Name </font></td></font>
<td align=left>
<select name=username style="HEIGHT: 22px; WIDTH:
185px">
<option value="" selected>
</select>
</td>
</tr>
<tr>
<td align=left>
<font face=arial color=darkgreen size=3><strong>
Password </font></td>
<td align=left>
<input name=password1 style="HEIGHT: 22px; WIDTH:
185px"
type=password >
</td>
</tr>
</table>
<p
align=center>
<input title="Click to Go" name=subm type=button value=Go
style="color:blue" onclick="sub_click()">
<input title="Click to Reset" name=reset1 type=button
value=Reset style="color:red" onclick="res()">
<br><br><center><a href=stores.asp title="Back to Main
Menu"><font size=5 face=tahoma color=blue><b>Back</b></font></a>
</p>
</form>
</b>
</body>
</html>
"
On Tue, 01 Mar 2005 Jonathan Hobbs wrote :
>Just to make sure I understand what you are trying to
>achieve...
>you want
>the user to enter some selection criteria, then based on what
>the
>user
>enters you display a second set of selection criteria, which
>the
>user then
>chooses from. You then take combine the user's two choices to
>create a
>mysql query or update command.
>
>If this is what you want, then I can think of three possible
>solutions (and
>I am sure there are more):
>
>Solution #1
>
>- create an html form which presents the first set of selection
>options.
>Have the form action send the results to a dtml method/python
>script
>- create a dtml method/python script which parses the users
>first
>selection
>and creates a new form with the second set of selection
>criteria.
>Include
>within the html form a set of 'hidden' form field elements
>which
>contain the
>user's first set of selection criteria. Have this form send
>the
>results to
>a second dtml method/python script
>- create a second dtml method/python script which parses the
>second
>selection form and grabs both the user-entered selection
>criteria
>(the
>second set of selection criteria) and also grabs the 'hidden'
>form field
>elements which contain the user's selections from the first
>form
>
>
>Solution #2
>
>- create an html form with hidden 'div's that you can display
>based on the
>user's first choice from the selection criteria. This will
>only
>work if:
>(i) there is a limited number of options for the second set of
>selection
>criteria, and (ii) the second set of selection criteria is
>'static'
>
>
>Solution #3
>
>- create an html form that has a javascript function that gets
>invoked when
>the user makes a choice from the selection criteria. This
>javascript
>function takes the user's selection and creates a url with the
>user's
>selection as parameters. The javascript function then uses the
>url to load
>a dtml method/python script into a hidden iframe in the
>original
>html form.
>The dtml method/python script receives the parameters (passed
>thru the url),
>processes them to determine the contents of the second set of
>selection
>criteria, then creates javascript variables containing the
>information for
>the second set of selection criteria. These javascript
>variables
>are then
>loaded into the hidden iframe and become accessible to the
>original
>javascript function which can then create and display the
>second
>set of
>selection criteria.
>
>This solution is a bit more difficult to implement, but if you
>don't want to
>reload the page while the user is looking it should do the
>trick!
>
>hth
>
>Jonathan
>
> From: "prabuddha ray" <buddha_2001 at rediffmail.com>
> > I'm using mysql database in my zope 2.7.
> > While creating a page i needed to get data in one combobox
>after
> > selecting data from another combobox. for this i need to do
>"page
> > reload " using something like onChange() of javascript.
>Javascript
> > won do DTML being a server side lang. I
> > How do handle such events in zope in dtml.
> > plz give a solution.
More information about the Zope
mailing list