HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS 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 9th, 2004, 10:14 AM
trueneutral trueneutral is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Nanaimo
Posts: 151 trueneutral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 28 sec
Reputation Power: 5
Converting javascript to vbscript

I am trying to convert a javascript I'm using into a vbscript, unfortunately I don't know very much about either to make it possible. If anyone has any suggestions that would be lovely.

Here's the javascript:

Code:
<script language="javascript">
    function confirm_delete() {
        if (confirm("Are you sure you want to delete this item?")==true)
	return true;
    return false; }
</script>


and I'm using a ItemCreated function to pick it up in ASP:

Code:
    Sub DataGrid_ItemCreated(ByVal Sender As Object, ByVal e As DataGridItemEventArgs)
        Select Case e.Item.ItemType
            Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem
                Dim myTableCell As TableCell
                myTableCell = e.Item.Cells(6)
                Dim myDeleteButton As LinkButton
                myDeleteButton = myTableCell.Controls(0)
                myDeleteButton.Attributes.Add("onclick", "return confirm_delete();")
        End Select
    End Sub

Reply With Quote
  #2  
Old January 9th, 2004, 11:37 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
in VBScript
Code:
Function confirm_delete()
   If(confirm("Are you sure you want to delete this item?") = true) Then
      value = true
   Else
      value = false
   End If

   confirm_delete = value
End Function

Reply With Quote
  #3  
Old January 9th, 2004, 11:52 AM
trueneutral trueneutral is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Nanaimo
Posts: 151 trueneutral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 28 sec
Reputation Power: 5
Thanks, I actually wrote something close to that myself, so I know I'm on the right track. The next step is this function:

Code:
    Sub DataGrid_ItemCreated(ByVal Sender As Object, ByVal e As DataGridItemEventArgs)
        Select Case e.Item.ItemType
            Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem
                Dim myTableCell As TableCell
                myTableCell = e.Item.Cells(6)
                Dim myDeleteButton As LinkButton
                myDeleteButton = myTableCell.Controls(0)
                myDeleteButton.Attributes.Add("onclick", "vbscript:confirm_delete();")
        End Select
    End Sub


(I changed the line: ("onclick", "return confirm_delete();")
to: ("onclick", "vbscript:confirm_delete();")

Now, the message box comes up, but I'm not getting a return value of true or false. (By that I mean when you click Yes or No, it deletes the item regardless of the selection) Any other ideas?

Thanks for your help already

Reply With Quote
  #4  
Old January 9th, 2004, 02:08 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
If you are doing this client-side you should keep it in JavaScript, and not do it in VBScript.

Reply With Quote
  #5  
Old January 9th, 2004, 02:40 PM
trueneutral trueneutral is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Nanaimo
Posts: 151 trueneutral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 28 sec
Reputation Power: 5
hehe actually I agree with you. I'm not even sure if it'll work in vbscript at all... My boss just has something against javascripts for some reason. But after getting him to take a look at it, he seems to think it should stay as a javascript this time (As in, we couldn't get the vbscript one to work )

Thanks for your advice

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Converting javascript to vbscript


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 1 hosted by Hostway