Passing value of a button thats not a Submit button

L

Lukelrc

Hi all,

I have an asp page with a delete button which has an OnClick Ok/Cancel
msgbox event. My problem is that in order to run the Onclick event
i've chaged the buttons type from "Submit" to "Button" - and now the
buttons value (which i need in the next page) is not passed in the
URL.

This is what i have tried to do:

<SCRIPT language="VBScript">
Sub btnDelete_onClick()
returnvalue=MsgBox ("Are you sure you want to delete this document
from the intranet?", VBOKCancel)
If returnvalue = 1 then
fmPressReleaseFields.action = "report.asp?btnDelete=Delete"
fmPressReleaseFields.submit()
end if
End Sub
</SCRIPT>

but for some reaseon the ?btnDelete=Delete part of the url is not
passed, possibly beacuse there are other values i'm passing that are
overwriting it(?)

Can anyone thing of a way to pass the butons value??

Thanks in advance.
 
H

Hans

Are you reading the data from the querystring and not from the form
collection on the server? Is fmPressReleaseFields assigned to the form?

An alternative would be to assign the value in a hidden field instead of
adding the value to the querystring and then submit the form.

BTW client side VB script is only supported by IE. You will have bigger
chance to get a crossbrowser solution if you use javascript if that matters
for you.

Regards
/Hans
 
L

Luke Curtis

Cheers,

It's an inranet asp site so i know everyone will be using IE.

fmPressReleaseFileds is the name of the form.

I guess i'm reading the data from thr collection on the server - i'm
just using Request("xyz") on the next page to collect the values.

I considered using a hidden field to pass the value, but the problem
with that is that i have several buttons on the page (Save, Delete and
cancel) and the hidden field would be submitted whichever button is
pressed - which would mess up the next page.

Maybe - is there a way to only submit the hidden field id the delete
button is pressed? Or to set the value of the hidden field in vbscript
OnClick event?








*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
L

Luke Curtis

Ah, I've just answerd my own question.

I added hidden field in named 'hdnDelete' and also added a line to the
OnClick event

fmPressReleaseFeilds.hdnDelete.value = "Delete"

Then on the next page when i say:

If Request("btnDelte")...

i wrote

If Request("btnDelete") or Request("hdnDelete")...

The answer is always much easyer than your expect!

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top