views:

46

answers:

2

How to solve the object required "checkMultiple" error. any idea how to disable the cmdButton7 when checkMultiple is checked and enable it when sum = 100. using VBSCRIPT.

Sub disableButton()
    If checkMultiple.value = 1 Then
        document.form1.cmdButton7.enabled = False
    ElseIf sum = 100 Then
        document.form1.cmdButton7.enabled = true
    End If 
End Sub

<input type="checkbox" name="checkMultiple" id="Multiple" onclick="disableButton">Multiple</input>
+1  A: 

You didn't even bother to tell us if this is ASP.NET or Classic ASP, or what.

But I'd guess you need to use the ID instead of the name. Try calling it "Multiple" instead of "checkMultiple".

John Saunders
sorry if i left that out.. its ASP.NET.
peggie
And, is this server-side code, or client-side code? You really need to give more detail.
John Saunders
@peggie see also http://www.w3schools.com/aspnet/control_checkbox.asp
Remou
@peggie: you're not making any sense. If it's ASP.NET, then it's not using VBScript!
John Saunders
sorry if i mixed up both of them.. ASP, client side vbscript.http://www.w3schools.com/vbscript/vbscript_intro.asp
peggie
@peggie: THANK you. I've updated your tags so that maybe someone who knows Classic ASP can help you. BTW, are you aware that "Classic ASP" is ancient and that almost nobody does new development in Classic ASP?
John Saunders
i got no choice but to do it. its part of my school project to come up with an automation tool, and thats what im given. And my knowledge for vbscript is zero. so gotta learn from scratch. Thanks for your help anyway (:
peggie
@peggie: you need a different school. It is nothing less that disgraceful for a school to require knowledge of such a dinosaur, much less to teach it! In any case, see [Active Server Pages](http://msdn.microsoft.com/en-us/library/aa286483.aspx). In particular, note the date on the [FAQ](http://msdn.microsoft.com/en-us/library/ms972347.aspx).
John Saunders
@peggie: also, note that your problem is not a VBScript problem, it's an ASP problem. VBscript, per se, doesn't know anything about HTML pages.
John Saunders
A: 

Try qualifying it more explicitly like this for example:

Sub disableButton()
    If document.form1.checkMultiple.value = 1 Then
        document.form1.cmdButton7.enabled = False
    ElseIf sum = 100 Then
        document.form1.cmdButton7.enabled = true
    End If 
End Sub

<input type="checkbox" name="checkMultiple" id="Multiple" 
 onclick="disableButton">Multiple</input>
Khorkrak
tried this method.. now having the object required "disableButton" error. Any way to solve it?
peggie