CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 [RESOLVED] Image Button- Send a URL param onclick

Print topic Send  topic

Author Message
ckroon

Posts: 869
Posted: 05/31/2008, 3:20 PM

I need a Submit button to send the URL parameter 'open=1' when it is clicked.

How do I code that into the onlick event of the button?

Thanks!

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
mentecky

Posts: 321
Posted: 06/01/2008, 1:46 AM

Quote ckroon:
I need a Submit button to send the URL parameter 'open=1' when it is clicked.

How do I code that into the onlick event of the button?

Thanks!


Could you describe your form more? Are there multiple Submit buttons?

Rick
_________________
http://www.ccselite.com
View profile  Send private message
datadoit
Posted: 06/01/2008, 6:49 AM

Many ways to do that. Here are a couple:

In the button's OnClick event (PHP) use the header() function to
redirect... header("Location:NewPage.php?open=1"); exit;

In the button's onClick event (javascript) use location to redirect...
window.location='NewPage.php?open=1'; return false;
ckroon

Posts: 869
Posted: 06/01/2008, 8:43 AM

Thanks Datadoit.. just what I needed. I am going to spend a few hours with my new Javacscript book today.

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
jjrjr1


Posts: 942
Posted: 06/01/2008, 9:21 AM

Hi

Here is another way to do it with the onclick event in case you want to add parameters to existing ones for the submit button. This can also make the added parameters dynamic at run time.

Add this javascript function to your common javascript area.

function addParmsToForm(form,parameters){
var action;
var connector="?";
action=document.forms[form].action;
if(action.search(/\?/)!=-1){connector="&";}
action=action+connector+parameters;
document.forms[form].action=action;
return true;
}

All you need to do is in the onclick event call this function and pass the form number that the submit button you want to change is and pass all the parameters you want. The first parameter should not contain a ? or & as this function will determine which to use. however if multiple params are sent separate them by the &.

Let me know how this works for you.


_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
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.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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