ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

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 Dev Shed Forums Sponsor:
  #1  
Old February 8th, 2004, 06:01 PM
spikedeath spikedeath is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 3 spikedeath User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Creating VBScript command dynamically using ASP passed value

ok this will be the death of me! lol

my ASP code creates a form and an array of chekbox with this statement response.write "<input type='checkbox' name='chkProduct" & Cstr(counter) & "' value='delete'>" all goes well and i also have a button that points to a VBScript function passing one parameter the counter start value so i can loop throught the checkboxs on the client side and determine if checked or not.
Ok i can display my command "document.frmProductCart.chkProduct & (Cstr(counter)) & .checked" as a string in alert but cannot make it as a command like it should be, anyone got any pointers ?
thx you ahead of time...

I have include the page in question. Sry i have not put any comments in it yet...
Attached Files
File Type: asp cart.asp (9.8 KB, 144 views)

Last edited by spikedeath : February 8th, 2004 at 06:05 PM.

Reply With Quote
  #2  
Old February 8th, 2004, 07:42 PM
spikedeath spikedeath is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 3 spikedeath User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I figured it out...
the trick was to use the Elements function like so
alert document.frmProductCart.elements(counter).checked
but be carefull with this as all types inputed in a forma are an element this works for me right now because i only have checkboxs and textboxes and checked function returns nothing on a textbox so it only checks the chkboxes ... get it ? lol

this is the code:
the chkbox:
response.write "<input type='checkbox' name='chkProduct' value='delete'>"
the button:
response.write "<INPUT TYPE='button' name='cmdDelete' value=' Delete ' onclick='DeleteProduct(" & Session("ProductCount") & ")'>"
and the function:
sub DeleteProduct(ProductCount)
dim counter
counter = ProductCount
do while counter > 0
if document.frmProductCart.elements(counter).checked then
/*code when checked*/
else
/*code when false*/
end if
counter = counter - 1
loop
end sub

Reply With Quote
  #3  
Old February 8th, 2004, 07:48 PM
spikedeath spikedeath is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 3 spikedeath User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
sry admin.. theyr an error in the previous code the elements function is an array thuse starting ar 0 and not 1 so a -1 should be place where the counter is inside the loop

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Creating VBScript command dynamically using ASP passed value


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



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

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





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT