p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: to Diable Buttons and detect row values by corresponding Buttons in the row


Message #1 by "Madhu" <madhujobs@m...> on Sat, 1 Jul 2000 4:8:14
Iam working with a ASP page where , depending up on user logged,

we must enable and disable buttons.



i have placed  a hidden text box in my page.

iam fetching a value in to this from login.asp page using form.request

method. 



i have placed 4 buttons in a table.



so i have written a function in javascript

where depending upon the value in the hidden text , it will disable 

the buttons.



when iam placing the buttons outside the table inthe body the code is 

working

but when the buttons are in Table, they are not getting disabled.

iam very confused why my code is not excuting when buttons placed in the 

table.



please le t me know why it is working. i tried both javascript and 

vbscript

please send me solution urgently. cause i need it urgently.

Thanks in advance.



This is my Code.







<html>

<head><title></title></head>

<script language="javascript">

function disable()

{

 if (document.appr.txtinf.value=="CM")

     documrnt.appr.btnca.disabled=true;

     else

     document.appr.btnrd.disabled =true;

  }

      

</script>



<%

  

	set objconn=server.CreateObject("ADODB.Connection")

		sConn = "Provider=MSDAORA.1;User ID=VIJAY;Data 

Source=rihr70dv;PASSWORD=psoft;"

		objconn.open sConn

	set rsapproval = server.CreateObject("ADODB.Recordset")

	

    if Request.Form("user")="sam" then

      set rsapproval = objconn.Execute("SELECT 

SSN,EMPLID,NAME,RI_TRAN_TYPE,EFFDT,DEPTID,JOBCODE,RI_APPROVAL_VALUE  FROM 

ps_ri_paf_approval ORDER BY RI_TRAN_TYPE,EFFDT")

	else

      set rsapproval = objconn.Execute("SELECT 

SSN,EMPLID,NAME,RI_TRAN_TYPE,EFFDT,DEPTID,JOBCODE,RI_APPROVAL_VALUE  FROM 

ps_ri_paf_approval where RI_APPROVAL_VALUE=2 ORDER BY RI_TRAN_TYPE,EFFDT")

    end if

    dim cbb

   

 %>  

<body background="images/sumtextb.jpg" onload="disable()">

<p align="right"><img src="images/alamo1.gif" name="pp" WIDTH="276" 

HEIGHT="97"></p>

<p align="left"><strong><font color size="5">Approval 

Process:</font></strong></p>

<form NAME="appr">

<table NAME="mm" BORDER="1" CELLSPACING="2" CELLPADDING="1">

<input TYPE="hidden" NAME="txtinf" value="<%=request.form("user")>

	<tr VALIGN="top" ALIGN="left">

		<td WIDTH="137"><p><font size="2">EX</td>

		<td WIDTH="137"><p><font size="2">CA</td>

		<td WIDTH="137"><p><font size="2">RA</td>

		<td WIDTH="137"><p><font size="2">RD</td>

 		<td WIDTH="137"><p><font size="2">SSN</td>

     	<td WIDTH="137"><p><font size="2">EmplID</td>

		<td WIDTH="137"><p><font size="2">Name</td>

		<td WIDTH="137"><p><font size="2">Tran.Type</td>

		<td WIDTH="137"><p><font size="2">Effective Date</td>

        <td WIDTH="137" HEIGHT="24"><p><font size="2">Dept.</td>

		<td WIDTH="137"><p><font size="2">Job Code</td>

		<td WIDTH="137"><p><font size="2">Appr.Code</font></td>

		

	 </tr>



<%

Do Until RSapproval.EOF

%>	 



	 <tr VALIGN="top" ALIGN="left" name="trtr">

        

		<td WIDTH="137"><p><input type="button" NAME="btnex" value="Ex" 

border="0" style="BACKGROUND-COLOR:lightyellow"></td>

		<td WIDTH="137"><p><input type="button" NAME="btnca" value="Ca" 

border="0" style="BACKGROUND-COLOR:lightblue" onclick="go()"></td>

		<td WIDTH="137"><p><input type="button" NAME="btnra" value="Ra" 

border="0" style="BACKGROUND-COLOR:lightyellow" onclick="to()"></td>

		<td WIDTH="137"><p><input TYPE="button" NAME="btnrd" value="Rd" 

border="0" style="BACKGROUND-COLOR:lightblue" onclick="to()"></td>

		<td WIDTH="137"><p><% response.write rsapproval("SSN") %><font 

size="2"></font></td>

		<td WIDTH="137"><p><% response.write rsapproval("EMPLID") %><font 

size="2"></font></td>

		<td WIDTH="137"><p><% response.write rsapproval("NAME") %><font 

size="2"></font></td>

		<td WIDTH="137"><p><% response.write rsapproval("RI_TRAN_TYPE") %><font 

size="2"></font></td>

		<td WIDTH="137"><p><% response.write rsapproval("EFFDT") %><font 

size="2"></font></td>

		<td WIDTH="137"><p><% response.write rsapproval("DEPTID") %><font 

size="2"></font></td>

		<td WIDTH="137"><p><% response.write rsapproval("JOBCODE") %><font 

size="2"></font></td>

		<td WIDTH="137"><p><% response.write rsapproval("RI_APPROVAL_VALUE") 

%><font size="2"></font></td>

	     

	 </tr>



<%

	RSapproval.MoveNext

Loop

%>		

 

	</table>

	</form>

	





<h6><font color="#0000ff">Copyright  2000 []. All rights reserved.<br>

Revised: <!--webbot bot="TimeStamp" S-Type="EDITED" S-Format="%B %d, %Y" 

startspan -->June 27, 2000<!--webbot bot="TimeStamp" endspan 

i-checksum="14296" -->

.</font></h6> </font></h6>

</body>



 


  Return to Index