Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 8th, 2006, 12:30 PM
Sprinjee Sprinjee is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 3 Sprinjee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 24 sec
Reputation Power: 0
Question Perform OnClick action multiple times

I'm trying to fill and update a table by means of a checkbox. The following code works fine when the check box is clicked once (the record in the column BasicLine is changed from 0 to 1) when the checkbox is clicked again (I want it to change from 1 to 0) it does not execute the update. If I refresh the page before I click it a second time it works fine (but I don't want to refresh... ). Does anyone know how to solve this??

Code:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/kv_conn.asp" -->
<%
var BasicLine = Server.CreateObject("ADODB.Recordset");
BasicLine.ActiveConnection = MM_kv_conn_STRING;
BasicLine.Source = "SELECT * FROM dbo.ProdLine";
BasicLine.CursorType = 0;
BasicLine.CursorLocation = 2;
BasicLine.LockType = 1;
BasicLine.Open();
var BasicLine_numRows = 0;
%>
<%
var up_BasicLine = Server.CreateObject("ADODB.Command");
up_BasicLine.ActiveConnection = MM_kv_conn_STRING;
up_BasicLine.CommandText = "if (select BasicLine from prodline) = 1 UPDATE prodline SET BasicLine = 0 else update prodline set BasicLine = 1";
up_BasicLine.CommandType = 1;

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<input <%=(((BasicLine.Fields.Item("BasicLine").Value) == 1)?"checked":"")%> name="BasicLine" type="checkbox" onClick="<% up_BasicLine.Execute() %>"value="">
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>
<%
BasicLine.Close();
%>

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Perform OnClick action multiple times


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway