This is my first time in this part of the forum.
I am no good at Javascript, so any help here as well as a solution would be really useful.
I have a form where there are several fields. One of them is a <select option> dropdown.
Within that dropdown is "Replacement", "Alternative" and "Refund".
What I want is for when the user select Alternative that a <input type = 'text'> field to *magically* appear on the right or below (doesn't matter where) that field. Basically so they can only complete that field when Alternative is selected.
I don't want to do it by disabling the field till they select - I want it dynamic so it gives the user that field.
I'm sure this is just a HIDE/DISPLAY type script as I have been looking.
For example, I found this:
Code: Select all
<script type="text/javascript" language="javascript">
<!--
function UpdateSelect()
{
select_value = document.report_form.preference.value;
var id = 'hide_this_row';
var obj = '';
obj = (document.getElementById) ? document.getElementById(id) : ((document.all) ? document.all[id] : ((document.layers) ? document.layers[id] : false));
if(select_value <> "alternative")
{
obj.style.display = ( obj.style.display != "none" ) ? "none" : "";//Hide Fields
}
else
{
obj.visibility = "show";//Show Fields
}
}
// -->
</script>Thanks in anticipation...
SML