nadeemshafi9 Posted October 31, 2007 Share Posted October 31, 2007 hello hers the code function addtoparent(id){ var relations = window.opener.document.getElementById('add_item_frm').product_relations.value; var relArray = relations.split(","); var action = "yes"; for(a in relArray) { if(relArray[a] == id) { action = "no"; newRelArray = relArray.splice(a-1,1); } } if(action != "no") { window.opener.document.getElementById('add_item_frm').product_relations.value = window.opener.document.getElementById('add_item_frm').product_relations.value + "," + id; } else { window.opener.document.getElementById('add_item_frm').product_relations.value = "," + newRelArray.join(); } } the parent window opens a child window using another function, this functiuon is used to add items to a textfeild like 324324,234324,234234 its done by checking the checkbox, but if u uncheck the checkbox it disapears of the parent windows textbox what happens is i do it on the onchange() of the check item and feed it the ID. whats happening is that i can add 3 id's 3434,32434,23432 and then when i try to remopve one they all get removed, but if i add 2 and remove 1 it works and if i add 1 and remove one it works, rember it has to remove the right id from the concatinated string in the parents textbox when i unchgeck the box it should know that the string has the id in it alrerady and force remove. thanks for any sugestions at all Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.