Slopey
Posts: 33
|
| Posted: 03/12/2007, 7:42 AM |
|
Hi All,
I've got 2 listboxes on a form which are dependant and I'm using the (excellent) CCT Dependent listbox builder to populate them which works a treat.
What I'd like to do is then load a textArea with a field from the database which is referenced by the bound value of the 2nd combo box.
However, I realise that this is going to execute client side if I don't want to reload the page. I'd rather not have to reload the page to update the text but I could if necessary, and pass the id of the record to the form and get it on the BeforeShow method, but then if the user populated most of the form, it would loose that data? Or is there an easy way to preserve it?
Alternatively, I could load all the info into an array at runtime and populate it using javascript/vbscript client side but for a big table that's going to be a performance/bandwidth problem so I'd like to avoid that.
Anyone got any ideas? (my Javascript is at best rudimentary, so if anyone has any specific examples, it would be much appriciated!).
|
 |
 |
mhope
Posts: 37
|
| Posted: 03/13/2007, 1:57 PM |
|
This is not tested but should work:
<script language="javascript">
function ShowTopCustomer(){
window.setTimeout("PopulateBusinessCard();",0);
}
function PopulateBusinessCard()
{
var myCombo = document.forms[0].elements["ComboBoxName"].value;
document.forms[0].elements["YourTextArea"].Value = myCombo;
}
//Change the ComboBoxName & YourTextArea to the actual name of the form elements
//Then in the combobox place this code: onchange="ShowTopCustomer()"
</script>
|
 |
 |
Slopey
Posts: 33
|
| Posted: 03/14/2007, 1:02 PM |
|
Thanks. However I wasnt wanting to copy the value of the combo box into the text area, I was wanting to populate the text area from the database based on the value of the combo which held the key field value.
Thanks anyway, I've managed to resolve it by just reloading the form although it is a bit messy for retaining the form values.
|
 |
 |
|