Well, I've run into a a problem. I'm in the middle of modifying an ATS system and need to add some functionality yet I've run into a strange thing in JavaScript. Basically I need to change a set of form values based on a selection from a drop down menu and the code works... when there is only one thing to change. The moment I add other sections that need to change it stops working. I've ran all over the internet and many Stack questions but nothing seems to help. The code that works is:
<form id="test" name="test">
<select id="statusID" name="statusID" onchange="javascript: return updateForm();">
<option value="" selected></option>
<option value="test1">One</option>
<option value="2">Two</option>
</select>
<br />
<input type="hidden" value="Test" id="RS" name="RS" />
</form>
<script type='text/javascript'>
function updateForm()
{
if (document.getElementById('statusID').selectedIndex == "2")
document.getElementById('RS').value = '200'
else if(document.getElementById('statusID').selectedIndex == "1")
document.getElementById('RS').value = 'RSP'
}
</script>
This works when I test it on the server yet when I add the other fields that need to be populated it stops working altogether. The JavaScript I'm using is below. I've tried a few variations based on code I've seen but to no avail.
<script type='text/javascript'>
function updateForm()
{
if (document.getElementById('statusID').selectedIndex == "2")
document.getElementById('RS').value = '200'
document.getElementById('RSDATE').value = '200'
document.getElementById('RSP').value = '200'
else if(document.getElementById('statusID').selectedIndex == "1")
document.getElementById('RS').value = 'RSP'
document.getElementById('RSDATE').value = 'RSP'
document.getElementById('RSP').value = 'RSP'
}
</script>
I should note that I am in no way proficient with JavaScript at all. Nor am I proficient in PHP... yet I'm modifying a PHP based ATS system. This code is the second to last block between me and the goal (finishing the ATS system) so help would be greatly appreciated.