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

 Dependent Listbox problem

Print topic Send  topic

Author Message
Muhd Fauzi
Posted: 07/23/2004, 3:40 AM

I inserted following code into onchange event of a listbox
window.location.href = "plkfrm.asp?linktypeid=" + this.value

but whenever I select the listbix, all other fields is reset to blank. How
to overcome this

tia

dataobjx


Posts: 181
Posted: 07/23/2004, 4:50 AM

When this code is executed: window.location.href = "plkfrm.asp?linktypeid=" + this.value ~ it calls another 'get' from the server, this time with the linkttypeid in the URL.

This is the same as if the person had saved that page (with the linktypeid=x in the url at the time when the page was 'saved') to their favorites... and had then executed it.

In your case, the person has added some data and then has selected a value from the listbox, causing the window.location.href code to be executed on the OnChange event.

In order to retain the information the person has already keyed in, you need to perform the following;

Click on the Page containing the ListBox (not on the record - on the page) and from the Properties window select the events tab. Right click on Before Show and select 'Add Code'.

Place the following code within the before_Show block.

Function Page_BeforeShow()
Dim sFName
Dim sLName

sFName = Request.Form("txtFirstName")
sLName = Request.Form("txtLastName")

RecordDataSource.txtFirstName.value = sFName
RecordDataSource.txtLastName.value = sLName

End Function

Do this for each field on the form...
Replace RecordDataSource with the actual name of your datasource.

Now, when the user selects the value from the listbox, the page performs a 'get'. The difference is that now it looks for any values that were on the page when the 'get' was executed and replaces them when the page load back up.
_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message
muhd fauzi
Posted: 07/23/2004, 10:19 AM

I've tried as below, but it does not work:

before_show()

dim cstationa
dim cstationb
dim cCapacity
dim clinktype
dim cplucount
dim cphylinkno
dim clength

cstationa = Request.Form("stationa")
cstationb = Request.Form("stationb")
cCapacity = Request.Form("capacity")
clinktype = Request.Form("linkype")
cplucount = Request.Form("plucount")
cphylinkno = Request.Form("phylinkno")
clength = Request.Form("length1")

pyphylink1.stationa.value = cstationa
pyphylink1.stationb.value = cstationb
pyphylink1.capacity.value = ccapacity
pyphylink1.linktype.value = clinktype
pyphylink1.plucount.value = cplucount
pyphylink1.phylinkno.value = cphylinkno
pyphylink1.length1.value = clength

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.

MS Access to Web

Convert MS Access to Web.
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.