CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Passing Parameters with a Button?

Print topic Send  topic

Author Message
Don_S

Posts: 50
Posted: 11/21/2005, 1:28 PM

I know when you create a Link, you can add parameters to pass along. Can you do the samething with a button? I would rather use a button for this use, not a link.

Thanks in advance,
Don
View profile  Send private message
Edd


Posts: 547
Posted: 11/21/2005, 1:46 PM

Don,
You can do this through either Javascript or the onclick event (forms).

My suggestion is Javascript calling a function.

Edd
_________________
Accepting and instigating change are life's challenges.

http://www.syntech.com.au
View profile  Send private message
Don_S

Posts: 50
Posted: 11/21/2005, 2:50 PM

I had tried using the onClick event but did not know how to code it. What would be the syntax for passing the pramater from the onClick event on a form?

Don
View profile  Send private message
Edd


Posts: 547
Posted: 11/21/2005, 4:04 PM

Don,
The Onclick event fires exactly as the submit of a form works.

Add the onclick event to the button, ensuring that the button's CCS functions (Add/Update/Delete) are NOT set to anything.

In the event get the parameters you want from the form using code such as
Dim UserID
UserID = CCGetParam("UserID", Empty)
If Not IsEmpty(UserID) Then
UnloadPage()
Reponse.Redirect "NewWindow.asp?UserID=" & UserID
End If

Hope that helps

Edd

_________________
Accepting and instigating change are life's challenges.

http://www.syntech.com.au
View profile  Send private message
Don_S

Posts: 50
Posted: 11/21/2005, 4:14 PM

Hi Edd,

Just tried that code and got the follow page error "Variable is undefined: 'Reponse'" Any ideas?

Don
View profile  Send private message
Edd


Posts: 547
Posted: 11/21/2005, 4:31 PM

Sorry my usual typo errors

Response.Redirect "NewWindow.asp?UserID=" & UserID

Edd

_________________
Accepting and instigating change are life's challenges.

http://www.syntech.com.au
View profile  Send private message
Paul Shearing
Posted: 12/11/2005, 1:50 AM

CCS3.

This is a useful technique but I cannot seem to get it working. So what am I doing wrong? I have a page open in the designer and in the toolbox I have the "Forms" tab selected. From this I click on "Button" and on so doing, a button is placed on the form. Then on the button Event properties I right-click on "On Click" in the Server node and select [Add Code]. This opens the events ASP page and I insert the following custom code, which is pretty much exactly what you recommend:

Function Button1_OnClick(Sender) 'Button1_OnClick @519-4C5ACEF5
'Custom Code @520-73254650
Dim BRL_ID
' -------------------------
BRL_ID = CCGetParam("BRL_ID", Empty)
If Not IsEmpty(BRL_ID) Then
UnloadPage()
Response.Redirect "WEB_FLEET_MEASURES.asp?BRL_ID=" & BRL_ID
Else
Response.Redirect "EMPTY_PARAM.htm"
End If
' -------------------------
'End Custom Code

I have added the Else clause to cause an action if the parameter is empty. When I publish the page, the button appears but on clicking it nothing happens.

Any ideas? Also, what is meant by "ensuring that the button's CCS functions (Add/Update/Delete) are NOT set to anything." ? I can see no obvious reference to such properties.

Kind regards

Paul
Paul Shearing
Posted: 12/11/2005, 8:47 PM

Ok guys (and gals).

I haven't solved this problem, but I have circumvented it by changing the application design. No need to bust a gut on this.

Thanks for looking anyway.

Paul
dataobjx


Posts: 181
Posted: 12/12/2005, 5:15 AM

You need to use Javascript to do this actually.

Since the code has a .js file, I cannot properly post a copy/paste answer to your question.

So, I've zipped the code necessary for you to perform this easily and have posted the file on http://dmpro.dataobjx.net.

After logging in, go to the documents area then click on Public Documents.

Locate and download the file called: ASP RequestQuerystring To Javascript

Contained within the file is a text file containing the script blocks that you place between the <head></head> section. You then modify it to accommodate any querystring values and then - you should be all set.

Hope this helps...
_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message
Paul Shearing
Posted: 12/12/2005, 11:15 AM

Thanks for this. Could you please email me a Login / Password on SoftDev@dial.pipex.com. I cannot see a way of creating an account.

Kind regards

Paul
dataobjx


Posts: 181
Posted: 12/12/2005, 12:15 PM

Paul,

My apologies.

First, to register go to: http://www.dataobjx.net - and register.

Then after registering, open a browser to: http://dmpro.dataobjx.net - and login.

Let me know how it works out for you - the code, I mean.
_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message
Don_S

Posts: 50
Posted: 12/12/2005, 2:30 PM

The code supplied by Edd works fine. I have this on the site I am working on and it works great , exactly as discribed by Edd in the eariler post.
I am using this in a Update button...

Don
View profile  Send private message
defiantclass1

Posts: 24
Posted: 01/11/2006, 9:14 AM

I was reading the subject and went to the specified site to get the mentioned zip file. After registering and logging in, I see nothing like "Public Documents".
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.