Alexander, you're dealing with two people named Chris here.  I sent you
the code with the Select Case.

The reason you place the ASP tags inside the client-side function is to
tell the SERVER that you want it to execute the code contained within
them.  That code uses Select Case to determine the value of fieldstatus
ON THE SERVER and then uses Response.Write ON THE SERVER to write out to
the CLIENT page being constructed just the code that is required when
fieldstatus matches one of a set of values.  You seem to understand that
ASP processing gets done once on the server - to create the page and
send it to the client - and then subsequent processing happens on the
client but maybe you're not following that thought all the way through.

As an aside before explaining further, I noticed after I sent my advice
that all three of your desired results whether fieldstatus is 1, 2 or 3
are the SAME as below.

<% ' this is processed by server
Select Case fieldstatus
  Case 1                
    Response.Write "window.IDfrm.IDradio2.disabled =true"
  Case 2
    Response.Write "window.IDfrm.IDradio2.disabled =true"
  Case 3
    Response.Write "window.IDfrm.IDradio2.disabled =true"
  Case Else
    ' whatever should happen if it's NOT 1,2,3!!
End Select
%>

So here's another reason to use Select Case (aside from it being clearer
to read and slightly faster).  You can do this:

<% ' this is processed by server
Select Case fieldstatus
  Case 1,2,3
    Response.Write "window.IDfrm.IDradio2.disabled =true"
  Case Else
    ' whatever should happen if it's NOT 1,2,3!!
End Select
%>

The result of this code is that if the fieldstatus variable contains 1,
2, or 3, then your CLIENT page code will look like this:

Sub LinkClick()
Dim strDis
msgbox "YOU CLIKED ME!!! I will now pass the parameters", 64, "HEY!"
window.IDfrm.IDradio2.disabled =true
End Sub

Whereas if the fieldstatus variable does NOT contain 1, 2, or 3 then
your CLIENT code will look like this:

Sub LinkClick()
Dim strDis
msgbox "YOU CLIKED ME!!! I will now pass the parameters", 64, "HEY!"
End Sub

Note that the window disabled code is not written to the page at all,
because fieldstatus was not 1,2,3.  I say again, since fieldstatus is
determined on the SERVER, then use it there to construct your client
code appropriately instead of having your client (a) getting code it
doesn't need in its page and (b) having the problem of getting your
SERVER's value into the CLIENT's memory space.

Clear now?


-----Original Message-----
From: Tsiris Alexandros [mailto:a.tsiris@;telesoft.gr] 
Sent: Tuesday, October 29, 2002 10:02 AM
To: ActiveServerPages
Subject: RE: passing variable to function



> But it's not going to be manipulated much if you hardcode your 
> fieldstatus variable the way I showed you how...
> 
> Chris Tifer


Yes, I am looking over tyhe cose again, and it seems better with the
case.

However, I can't why you would place ASP tags in a function that's
decalred under vbscript???

>From what I know, it works for variables, but I fdont think you can 
>actually
have complete ASP tags and process them server side on this function.

 

---
You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED] To unsubscribe send a blank email to
%%email.unsub%%



---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to