Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:43 PM
Lukelrc
Guest
 
Posts: n/a
Default Passing value of a button thats not a Submit button

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.
  #2  
Old July 19th, 2005, 01:43 PM
Hans
Guest
 
Posts: n/a
Default Re: Passing value of a button thats not a Submit button

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


  #3  
Old July 19th, 2005, 01:43 PM
Luke Curtis
Guest
 
Posts: n/a
Default Re: Passing value of a button thats not a Submit button

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!
  #4  
Old July 19th, 2005, 01:43 PM
Luke Curtis
Guest
 
Posts: n/a
Default Re: Passing value of a button thats not a Submit button

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!
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles