CodeCharge Studio
search Register Login  

Visual PHP Web Development

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

YesSoftware Forums -> CodeCharge Studio -> ASP

 Open a new ASP page containing the value of the listbox

Print topic Send  topic

Author Message

Posts: 26
Posted: 11/16/2009, 11:50 AM

Hi there.

Im using a search for with a listbox that contains a list a Cities. Once the search button is pressed, i want the form to open a new asp page that contains the value of the listbox (the city selected, of course).

For example, the main page, where the search form is located is:

And if the city "Seville" is selected, i want the asp to redirect to :

Could you please help me???


View profile  Send private message

Posts: 154
Posted: 11/16/2009, 4:12 PM

This is code I use for a link, rather than a button. But it might be a start.

This is the html for the link - note the added onclick event.

<a href="" id="controlId" onclick="JavaScript: return showCity(this);">Show City</a>

And here is the Javascript for the showCity(controlReference) function. You'll need to replace the "CitiesComboBox" string with the Id that Codecharge gives to your Cities combobox/list.
function showCity(ctl)  
        var cityName= document.getElementById("CitiesComboBox").value;  
        if (cityName == "")  
                alert("please select a city");  
                return false;  
        } else  
                ctl.href = "" + cityName + ".asp";  
So, when you click the link, this function checks the selected value of the combobox. If it's blank (nothing selected) you get an alert. If not, it builds a URL with the cityName at the end, and puts it in the link's href property.

To make this work for a button rather than a link, you could try replacing "ctl.href" with "window.location.href " and replace the final "return" with "return false"
View profile  Send private message

Posts: 26
Posted: 11/19/2009, 11:13 AM

Hey THANKS A LOT ! It worked perfectly. Both ones, with a link and with a button.


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

Web Database

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

Home   |    Search   |    Members   |    Register   |    Login

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