How to set the value of dropdown form field to null, when the field is disabled

Hi,

I have multiple dropdown fields in a form. For example i have 3 dropdown fields called 'list1', 'listA' and 'listB'. Thanks to @Christopher gillis for his blog,  i can able to disable 'listB' dropdown field when the value of 'list1' is 'listA' . similary,  disables 'listA' dropdown field when the value of 'list1' is 'listB'. my Problem is when i add an item, if i choose 'listA' from dropdown field 'list1', it enables 'listA' and  i will choose a value call as 'Pannelleria' from dropdown list 'listA'. After sometime when i want to edit the item,  i want to change the value of 'list1' from 'listA' to 'listB', i could able to disable the 'listA' and set the value to null on the form page and enables the 'listB' dropdown list. At this point, the value of dropdown field 'listA' is not set to null in database, instead it showing the value as 'Pannelleria'. i'm missing some code which give access to update the value in database. I attached following method in form events under OnFormPopoulate. Any suggestions or help is appreciable.! As i'm not a hard core programmer, improvising my code is also appreciable which helps me in learning. 

I'm working on Aras V12.0

Thanks.

regards,

Venkat.


var input = document.getElementsByName("list1")[0];
var input1 = document.getElementsByName("listA")[0];

var input2 = document.getElementsByName("listB")[0];

setTimeout(function(){

if(input.getElementsByTagName("input")[0].value == "listA"){

input2.getElementsByTagName("input")[0].value = "";
input2.getElementsByTagName("input")[0].disabled = true;

input2.getElementsByTagName("button")[0].disabled = true;

input1.getElementsByTagName("input")[0].disabled = false;

input1.getElementsByTagName("button")[0].disabled = false;

}

else if (input.getElementsByTagName("input")[0].value == "listB"){

input1.getElementsByTagName("input")[0].value = "";
input1.getElementsByTagName("input")[0].disabled = true;

input1.getElementsByTagName("button")[0].disabled = true;

input2.getElementsByTagName("input")[0].disabled = false;

input2.getElementsByTagName("button")[0].disabled = false;

}

},100);