hbfaither
Posts: 15
|
Posted: 04/21/2004, 12:50 PM |
|
would like to include the following function (mrsr_data_Button) into my program. I added the function to the end of 'common.asp'. I then included the following code into the HTML through format event "on change". Keep receiving the following error: "Object expected".
any help appricated.
Function mrsr_data_button(button_name)
dim A_action
A_action = "A"
mrsr_data.button_name.visible = false
If not isempty(mrsr_data.button_name.value) then
if (mrsr_data.button_name.value <> A_action) then
mrsr_data.button_name.visible = true
end if
end if
end function
HTML:
<td class="CobaltDataTD" align="middle" valign="center">
<select name="{subcat01_action_Name}" class="CobaltSelect" onchange="mrsr_data_button('subcat01_button')">
<option value="" selected>Select Value</option>
{subcat01_action_Options} </select>
</td>
|
|
|
peterr
Posts: 5971
|
Posted: 04/22/2004, 1:47 AM |
|
It looks like you are mixing the code on the client with the code on the server. This cannot work because the client (browser) doesn't know anything about the server and about common.asp. The HTML is simply sent to the user's browser and displayed there, but someone's browser cannot have access to your server.
Therefore the "onchange" command in HTML can only execute functions that are also within the HTML, usually coded in JavaScript/DHTML ( http://www.w3schools.com/dhtml/default.asp ). You would probably need to recreate your function in JavaScript, however I'm not sure if or how the JavaScript could hide controls. Or you may use the server function, but only once - it cannot be executed when the users change some values on the page, unless you submit the page to the server and then it will be reloaded in the user's browser with the new value.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
|