|
-
Jun 12th, 2001, 10:06 AM
#1
Thread Starter
Addicted Member
What's wrong w/ this code ?
<SCRIPT LANGUAGE="VBScript">
<!--
Sub cmdNotifier_OnClick()
Dim i
With document.frmNotification
.Atteindre.value = ""
For i = 1 to <%= rsPrets.RecordCount %>
If .chkNotifier(i).checked = True Then
.Atteindre.value = .Atteindre.value & .chkNotifier(i).value & ";"
End if
Next
End With
msgbox .Atteindre.value
End Sub
' -->
</SCRIPT>
</HEAD>
<BODY bgcolor="#0D0D6D" text="black" >
<Form name=frmNotification method=post>
<Table height=239 cellPadding=10 width=396 align=center bgColor=#d4d0c8 border=8 style="WIDTH: 396px; HEIGHT: 239px" id=TABLE1>
<% rsPrets.MoveFirst
While not rsPrets.EOF %>
<Tr><Td Width=20><Input name=chkNotifier id=chkNotifier Value=<%= rsPrets.AbsolutePosition%> type=checkbox checked></Td>
</Tr>
<% rsPrets.MoveNext
Wend %>
</Table>
</Td></Tr>
<Tr><Td align="MIDDLE">
<INPUT Type="button" name="cmdNotifier" id=cmdNotifier value="Notifier">
<INPUT TYPE="button" VALUE="Fermer" id=cmdFermer name=cmdFermer><br>
</Td></Tr>
</Table>
<INPUT TYPE="hidden" SIZE="4" NAME="MoveAction" value="Move">
</BODY>
</HTML>
I got error in VBScript, when clicking on cmdNotifier :
chkNotifier : Object not defined
-
Jun 12th, 2001, 10:51 AM
#2
Addicted Member
Do you have a copy of the produced html? the original ASP doesnt help diagnose browser problems...
-
Jun 12th, 2001, 11:06 AM
#3
Thread Starter
Addicted Member
<HTML>
<HEAD>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Main()
End Sub
Sub cmdFermer_OnClick()
document.location.href="frmDefault.asp"
End Sub
Sub cmdNotifier_OnClick()
Dim i
With document.frmNotification
.Atteindre.value = ""
For i = 1 to 3
If .chkNotifier(i).checked = True Then
.Atteindre.value = .Atteindre.value & .chkNotifier(i).value & ";"
End if
Next
End With
msgbox .Atteindre.value
End Sub
' -->
</SCRIPT>
</HEAD>
<BODY bgcolor="#0D0D6D" text="black" onload="Call Main()">
<Form name=frmNotification method=post>
<Table height=239 cellPadding=10 width=396 align=center bgColor=#d4d0c8 border=8 style="WIDTH: 396px; HEIGHT: 239px" id=TABLE1>
<Tr><Td>
<B>Notification</B><HR><BR>
<Table border=1 width=500>
<Tr><Td Width=20></Td>
<Td Width=160><Font Face="Courier New" size=2>User</Font></Td>
<Td Width=200><Font Face="Courier New" size=2>Prog</Font></Td>
<Td Width=100><Font Face="Courier New" size=2>Return Date</Font></Td>
<Td Width=40 Align="Middle"><Font Face="Courier New" size=2>*</Font></Td>
</Tr>
<Tr><Td Width=20><Input name=chkNotifier id=chkNotifier Value=1 type=checkbox checked></Td>
<Td Width=160><Font Face="Courier New" size=2>Test name</Font></Td>
<Td Width=200><Font Face="Courier New" size=2>Test proggie</Font></Td>
<Td Width=100><Font Face="Courier New" size=2>2001-06-07</Font></Td>
<Td Width=40 Align="Middle"><Font Face="Courier New" size=2>0</Font></Td>
</Tr>
<Tr><Td Width=20><Input name=chkNotifier id=chkNotifier Value=2 type=checkbox checked></Td>
<Td Width=160><Font Face="Courier New" size=2>Test name2</Font></Td>
<Td Width=200><Font Face="Courier New" size=2>Test proggie2</Font></Td>
<Td Width=100><Font Face="Courier New" size=2>2001-06-07</Font></Td>
<Td Width=40 Align="Middle"><Font Face="Courier New" size=2>0</Font></Td>
</Tr>
</Table>
</Td></Tr>
<Tr><Td align="MIDDLE">
<INPUT Type="button" name="cmdNotifier" id=cmdNotifier value="Notifier">
<INPUT TYPE="button" VALUE="Fermer" id=cmdFermer name=cmdFermer><br>
</Td></Tr>
</Table>
<INPUT TYPE="hidden" SIZE="4" NAME="MoveAction" Value="Move">
<INPUT TYPE="hidden" SIZE="4" NAME="Atteindre">
</Form>
</BODY>
</HTML>
Last edited by eL_NiNo; Jun 12th, 2001 at 01:18 PM.
Regards,
El-Nino
-
Jun 12th, 2001, 11:11 AM
#4
Addicted Member
You only have one checkbox assigned to the name "chknotifier", but your trying to check three of them...
Plus make sure all your values in HTML have speech marks round them, or netscape will cough up a lung.
-
Jun 12th, 2001, 11:36 AM
#5
Frenzied Member
Oh, sorry, forgot to mention.
In the DOM, a single element does not create an array of length 1. If you have two, then you have an array of length 2.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Jun 12th, 2001, 01:17 PM
#6
Thread Starter
Addicted Member
Ok assume the statement repeats 3 times (hence the 3 in the for) I cut it out coz It was not relevant to this post since it's exactly the same except : Testuser2 Testporggie2 and so on...
-
Jun 13th, 2001, 04:23 AM
#7
Addicted Member
Dude, you have a syntax error, which means one single character could be wrong, so I need ALL of the code, from the server, not as you think it should be.. Or Its impossible to solve.. The code as you put it should work, but Id take out the "with" command, as vbscript support of that has always been flaky between browser sub-versions..
-
Jun 13th, 2001, 08:19 AM
#8
Thread Starter
Addicted Member
Ok I'll repost it soon !
If it can help 
I'll repost the whole code but I can't see what's wrong :P
-
Jun 13th, 2001, 09:02 AM
#9
Addicted Member
If you post it all, Ill find out whats wrong with it, I guarantee
-
Jun 13th, 2001, 09:07 AM
#10
Thread Starter
Addicted Member
Here you go once again :p
<HTML>
<HEAD>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Main()
End Sub
Sub cmdFermer_OnClick()
document.location.href="frmDefault.asp"
End Sub
Sub cmdNotifier_OnClick()
Dim i
With document.frmNotification
.Atteindre.value = ""
For i = 1 to 3
If .chkNotifier(i).checked = True Then
.Atteindre.value = .Atteindre.value & ";" & .chkNotifier(i).value
End if
Next
' On élimine le ";" au début
If .Atteindre.value <> "" Then .Atteindre.value = Right(.Atteindre.value, Len(.Atteindre.value) - 1)
End With
msgbox .Atteindre.value
End Sub
' -->
</SCRIPT>
</HEAD>
<BODY bgcolor="#0D0D6D" text="black" onload="Call Main()">
<Form name=frmNotification method=post>
<Table height=239 cellPadding=10 width=396 align=center bgColor=#d4d0c8 border=8 style="WIDTH: 396px; HEIGHT: 239px" id=TABLE1>
<Tr><Td>
<B>Notification</B><HR><BR>
<Table border=1 width=500>
<Tr><Td Width=20></Td>
<Td Width=160><Font Face="Courier New" size=2>User</Font></Td>
<Td Width=200><Font Face="Courier New" size=2>App</Font></Td>
<Td Width=100><Font Face="Courier New" size=2>Date</Font></Td>
<Td Width=40 Align="Middle"><Font Face="Courier New" size=2>*</Font></Td>
</Tr>
<Tr><Td Width=20><Input name=chkNotifier id=chkNotifier Value=1 type=checkbox checked></Td>
<Td Width=160><Font Face="Courier New" size=2>Name 1</Font></Td>
<Td Width=200><Font Face="Courier New" size=2>App 1</Font></Td>
<Td Width=100><Font Face="Courier New" size=2>2001-06-07</Font></Td>
<Td Width=40 Align="Middle"><Font Face="Courier New" size=2>0</Font></Td>
</Tr>
<Tr><Td Width=20><Input name=chkNotifier id=chkNotifier Value=2 type=checkbox checked></Td>
<Td Width=160><Font Face="Courier New" size=2>Name 2</Font></Td>
<Td Width=200><Font Face="Courier New" size=2>App 2</Font></Td>
<Td Width=100><Font Face="Courier New" size=2>2001-06-08</Font></Td>
<Td Width=40 Align="Middle"><Font Face="Courier New" size=2>0</Font></Td>
</Tr>
<Tr><Td Width=20><Input name=chkNotifier id=chkNotifier Value=3 type=checkbox checked></Td>
<Td Width=160><Font Face="Courier New" size=2>Name 3</Font></Td>
<Td Width=200><Font Face="Courier New" size=2>App 3</Font></Td>
<Td Width=100><Font Face="Courier New" size=2>2001-06-08</Font></Td>
<Td Width=40 Align="Middle"><Font Face="Courier New" size=2>0</Font></Td>
</Tr>
</Table>
* Notifié
</Td></Tr>
<Tr><Td align="MIDDLE">
<INPUT Type="button" name="cmdNotifier" id=cmdNotifier value="Notifier">
<INPUT TYPE="button" VALUE="Fermer" id=cmdFermer name=cmdFermer><br>
</Td></Tr>
</Table>
<INPUT TYPE="hidden" SIZE="4" NAME="MoveAction" Value="Move">
<INPUT TYPE="hidden" SIZE="4" NAME="Atteindre">
</Form>
</BODY>
</HTML>
-
Jun 13th, 2001, 09:22 AM
#11
-
Jun 13th, 2001, 09:29 AM
#12
Thread Starter
Addicted Member
Actually this works; clicking on the button calls the cmdNotifier_OnClick()
The problem is in the script itself or in my location of checkbox, I don't know but it's strarting to annoy me
-
Jun 13th, 2001, 09:35 AM
#13
Addicted Member
I tried it on ie6/5/4 and netscape 6/4 and none of them do anything... Not a sausage. Where are you testing it? And what should it do? I cant even get your error.
-
Jun 13th, 2001, 09:40 AM
#14
Thread Starter
Addicted Member
IE5.5
And this is working pretty well with all the other pages I made...
-
Jun 13th, 2001, 09:43 AM
#15
Addicted Member
I must admit, Im having some problems understanding the purpose of the page, but I have spotted something. Checkbox arrays in vbscript start with 0 dont they? That may explain why it cant find the checkbox our after..
-
Jun 13th, 2001, 10:19 AM
#16
Thread Starter
Addicted Member
No more worries
Well forget this thread guys; I figured out what was my problem; I rewrote it completly and it works now; seems like the checkboxes didn't like the value statement given by my ASP, so I used another way to do that, thanks !
Thanks for all help !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|