Hello List!
I'm new to JavaScript and am hoping someone out there can help me with an issue I'm having setting a value on a form...
I have two fields, 'Current Capacity' and 'Support Capacity' -> If the user inputs a value into the 'Current Capacity' field, I want to set the value of 'Support Capacity' to zero; and vice versa, if the user inputs a value into 'Support Capacity', I want to set the value of 'Current Capacity' to zero.
Here's the code I've got to try and do this:
Problem is, when I click the 'Submit' button, nothing is happening; if I comment these two statements out, it works -- so I know my problem lies in these two statements...
Any help anyone could provide on how to correct this would be greately appreciated!
Thanks in advance for your time and help!
-jiggyg
I'm new to JavaScript and am hoping someone out there can help me with an issue I'm having setting a value on a form...
I have two fields, 'Current Capacity' and 'Support Capacity' -> If the user inputs a value into the 'Current Capacity' field, I want to set the value of 'Support Capacity' to zero; and vice versa, if the user inputs a value into 'Support Capacity', I want to set the value of 'Current Capacity' to zero.
Here's the code I've got to try and do this:
Code:
if (document.forms[0].currentCapacity.value != "" ){
(document.forms[0].supportCapacity.value) = 0;
return;
}
else if (document.forms[0].supportCapacity.value != "" ){
(document.forms[0].currentCapacity.value) = 0;
return;
}
Problem is, when I click the 'Submit' button, nothing is happening; if I comment these two statements out, it works -- so I know my problem lies in these two statements...
Any help anyone could provide on how to correct this would be greately appreciated!
Thanks in advance for your time and help!
-jiggyg