View Full Version : Problem client - server / ASP vs. Javascript

04-06-2006, 11:31 AM

I have a problem wich I think it has to do with client - server. I'am writing a page with ASP. I'am writing back some data in selection fields.
With Javascript function I assign the value to 'IFOR_Attr_1':

document.all['IFOR_Attr_1'].value = TTTEXT_IFOR_array[selindex-1];
alert("If-waarde parm Field: " + Field + " waarde parm IFOR_Field: " + document.all['IFOR_Attr_1'].value);

With the alert I see the value of 'IFOR_Attr_1' is 1. this is correct.

But further in the code I need this value with a ASP request on IFOR_Attr_1 like:

Call displaytext("Attr_1 " + Request("IFOR_Attr_1"))
Call WriteKenmerkenCriteria("Attr_W1", Request("IFOR_Attr_1"), Request("CHAR_Attr_1"))

But now is the value of IFOR_Attr_1 empty. At least not 1.
My conclusion is that the value for IFOR_Attr_1 is at the client side changed but not at the server side?

How can I solve this?

Anyway is it possible to assign a value to a ASP variable with javasript code like:

Dim Aspvar
Aspvar = javascript:function()

Thanks in advanced,


04-09-2006, 04:00 PM
The asp code is processed long before the javascript is even written out. Server side code is always executed before client side code is. If you need to alter a value using clientside coding, then you need to submit the page afterwards for the server to see the alteration.