davep
Posts: 41
|
| Posted: 02/06/2009, 9:32 AM |
|
I have a listbox where the textcolumn is an alphanumerical code and the boundcolumn is an integer. On the same form, I have a textbox that, when in insert mode, will always begin with the code from the textcolumn of the listbox. Since this is always the case, I want to preload this code into the textbox, so that the user doesn't have to enter it - they would only append to the end of the code.
The listbox columns are PolicyID and PolicyCode. The ID is the boundcolumn and the Code is the textcolumn. The textbox is also PolicyCode, but the inserted record will always be a child of the Code selected in the listbox. An example is a selection of PolicyID=7, PolicyCode="ITAD" in the listbox. Then I want the PolicyCode textbox to present "ITAD" so the user can simply enter "101" resulting in an inserted record of PolicyCode="ITAD101."
Does this make any sense? Can anyone help me?
Thanks,
Dave
|
 |
 |
datadoit
|
| Posted: 02/06/2009, 10:39 AM |
|
Dave, declare your environment please (PHP, ASP, etc.).
|
|
|
 |
davep
Posts: 41
|
| Posted: 02/06/2009, 10:46 AM |
|
I'm sorry - I'm using ASP.
|
 |
 |
mentecky
Posts: 321
|
| Posted: 02/07/2009, 9:28 AM |
|
davep,
Click your listbox. In events add code to Client On Change. Use something like the following:
document.getElementById('textbox').value = document.getElementById('listbox').text;
Rick
_________________
http://www.ccselite.com |
 |
 |
davep
Posts: 41
|
| Posted: 02/07/2009, 3:13 PM |
|
Quote mentecky:
davep,
Click your listbox. In events add code to Client On Change. Use something like the following:
document.getElementById('textbox').value = document.getElementById('listbox').text;
Rick
Wow, I thought, "Great!" It sounded like it should work, but it doesn't. I entered the code, and I get "undefined" written into the textbox.
Any ideas?
Thanks
|
 |
 |
mentecky
Posts: 321
|
| Posted: 02/07/2009, 11:26 PM |
|
Wow!!! My last answer totally sucked!
Sorry, I was in a rush this AM and posted a half assed answer. Here's the real deal and I tested it to boot.
document.getElementById('TextArea1').value = document.getElementById('gallery_image_id').options[document.getElementById('gallery_image_id').selectedIndex].text;
You can see that actually work at: http://www.ccselite.com/test_image.php
Sorry if I wasted any of your time with a bad answer.
Rick
_________________
http://www.ccselite.com |
 |
 |
mentecky
Posts: 321
|
| Posted: 02/07/2009, 11:29 PM |
|
In the above example "TextArea1" is the textarea and gallery_image_id is the listbox.
Rick
_________________
http://www.ccselite.com |
 |
 |
davep
Posts: 41
|
| Posted: 02/08/2009, 6:39 AM |
|
Quote mentecky:
Wow!!! My last answer totally sucked!
Sorry, I was in a rush this AM and posted a half assed answer. Here's the real deal and I tested it to boot.
document.getElementById('TextArea1').value = document.getElementById('gallery_image_id').options[document.getElementById('gallery_image_id').selectedIndex].text;
You can see that actually work at: http://www.ccselite.com/test_image.php
Sorry if I wasted any of your time with a bad answer.
Rick
Thanks Rick,
That worked perfectly, and you taught me how to access the text of those option entries to boot!
Many thanks,
Dave
|
 |
 |
mentecky
Posts: 321
|
| Posted: 02/08/2009, 1:18 PM |
|
Dave,
No problem. Glad to help!
Rick
_________________
http://www.ccselite.com |
 |
 |
|