CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> Archive -> GotoCode Archive

 ListBox after select Event Code

Print topic Send  topic

Author Message
Omar
Posted: 02/22/2002, 9:06 PM

Say there is a form of Record type, with 5 feilds, key feild is a ListBox, I like to have the second feild (type label) to get populated after I select a value in the listbox.
Exmp Milestone_feild (Invoiced) will show the status_feild(Financial Transaction created).
thx
Nicole
Posted: 02/23/2002, 2:07 AM

Omar,
it could be done via JavaScript. Refer to Dependent Listboxes article: http://www.gotocode.com/art.asp?art_id=45&
But JavaScript doesn't work with Label type fields. The workaround is to use read only textbox field instead Label.
Andrew B
Posted: 02/24/2002, 5:49 PM

You are going to want to make a disabled textbox, like was said. If this is IE only, then you can use the innerHtml property (wrong case, i think) to replace the label text, but it gets sketchier doing that with NS/Opera/etc.

You want to make a script area in the form footer and do something like this :
<script language="javascript">
var f;
f = document.forms['MyFormName'];
f.SelectBoxName.onchange = WhenItChanges;

function WhenItChanges() {
f.DisabledTextBox.text = f.SelectBox.value;
}
</script>

If you don't want the 'value' field because it is a number, but you want the text field, then you are going to need to replace that last line with :

f.DisabledTextBox.text = f.SelectBox.options[f.SelectBox.selectedIndex].text;

It also works with hidden values.

   


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.