Hello, im using this function to hide some inputs from a form when a value selected in select tag.
this is the function:
function showEntry(obj,optionValue){
//hide all entry selections onchange
document.getElementById("group1").style.display="none";
document.getElementById("group2").style.display="none";
if(obj.value=="group1")
{
document.getElementById('group1').style.display="inline";
}
else if(obj.value=="group2")
{
document.getElementById('group2').style.display="inline";
}
}
and this is the form:
<select class="textinput" name="function_title" onchange="showEntry(this,this.value);">
<option value=""> </option>
<option value="group1" >group1</option>
<option value="group2" >group2</option>
</select>
<span id="group1" style="display:none;">
<input class="textinput" type="text" id="input1" name="input1" value="100"/>
<input class="textinput" type="text" id="input2" name="input2" value="50"/>
</span>
<span id="group2" style="display:none;">
<input class="textinput" type="text" id="input3" name="input3" value="60"/>
<input class="textinput" type="text" id="input4" name="input4" value="45"/>
</span>
All i want is to hide the hidden inputs value when this group of inputs are hidden.
Something like that:
<input class="textinput" type="text" id="input3" name="input3" value="if(obj.value!="group2") { print(60); }"/>
Is that right?