|
-
May 15th, 2013, 02:35 PM
#1
Thread Starter
Lively Member
Re: Drop down boxes and javascript - How to get the value
*smacks head* I did figure this out this morning before I read your post. Either way, I did make a couple of minor changes based of your ideas. Heres what I came up with:
1. Create a reference to the control at the BOTTOM of the page(cant reference a control if it hasnt been drawn yet:
<script>
var j_TitleCompanyNameRef = document.getElementById('ddlTitleCompanyName');
</script>
2. added this to the onchange event of the drop down list:
onchange="getTitleCompanyFaxAndPhone()"
3. then rewrote the function, like so:
<CODE>
function getTitleCompanyFaxAndPhone() {
//not all title companies have a standard phone and fax number which is why not all title companies are listed here
//if a company is selected in the ddl that has no case here, it defaults to the default at the end of the Case statement
var j_TitleCompanyNameVal = j_TitleCompanyNameRef.options[j_TitleCompanyNameRef.selectedIndex].value;
switch (j_TitleCompanyNameVal) {
case "Title Company1":
document.PayoffEForm.txtPhoneNumber.value = '';
document.PayoffEForm.txtFaxNumber.value = "321-654-0987";
break;
case "Title Company 2":
document.PayoffEForm.txtPhoneNumber.value = '';
document.PayoffEForm.txtFaxNumber.value = "123-456-7890";
break;
default:
//alert('Error!');
document.PayoffEForm.txtPhoneNumber.value = '';
document.PayoffEForm.txtFaxNumber.value = '';
break;
}
}
</CODE>
and POOF! it works!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|