set text field using select list value and javascript
drenner1Feb 25 2008 — edited Feb 27 2008I have a select list field and a regular text field .... I want the text field value to be set based on the user selecting a value from the select list .... the select list displays a string value and the 'return value' is a number. I have looked on the forum and tried a number of aproaches that have been posted but cannot get anything to work ..... here is my code below ....
**********************************************************************************
code below is in the html header for the page:
<script language="JavaScript" type="text/javascript">
<!--
htmldb_delete_message='"DELETE_CONFIRM_MSG"';
//-->
</script>
<script language="JavaScript" type="text/javascript">
funtion set_abcd_id()
{
function getVal(item)
{
if (document.getElementById(item).value != "")
return parseFloat(document.getElementById(item).value);
else
return 0;
}
document.getElementById('P1_ABCD_ID2').value = getVal('P1_DETAIL_ABCD_ID');
}
</script>
p1_detail_abcd_id is the select field; p1_abcd_id2 is the regular text field;
******************************************************************************************
code below is in the html element attributes for the select list field ...
onchange="set_abcd_id(html_SelectValue(this.value));"
i also tried
onchange="set_abcd_id();"
but nothing works at this point.
I would really appreciate someone helping me understand what I am doing wrong ...
Thnak You