String onChangeString = "childSwapped(window.document.forms[0]." + childSelectName + ".options[selectedIndex].value,"+selectedChildId+");";
String onChangeString = "childSwapped("+parentsChildrenId + "," +"window.document." + formName() + "." + childSelectName + ".options[selectedIndex].value," +parentSelectName+"," +selectedParentId+"," +selectedChildId+");";
    public String childPopUpString() {        String onChangeString = "childSwapped(window.document.forms[0]." + childSelectName + ".options[selectedIndex].value,"+selectedChildId+");";        StringBuffer returnString = selectHeader(childSelectName, onChangeString, selectedChild(), childPopUpStringForAll());        String prePendText = null;        if (selectedParent() != null) {            if (selectedChild()==null && defaultChildKey()!=null)                setSelectedChild(NSKeyValueCoding.Utility.valueForKey(selectedParent(), defaultChildKey()));            NSArray children = sortedChildren(selectedParent());            // write out each of the values for the options tags. be sure to set the selected tag if necessary            int iCount = children.count();            for (int i=0;i<iCount;i++) {                Object aChild = children.objectAtIndex(i);                returnString.append("\t<option ");                if ((i == iCount-1) && (selectedChild() == null) && (childPopUpStringForAll() == null)) {                    returnString.append("selected ");                } else if (aChild.equals(selectedChild())) {                    returnString.append("selected ");                }                returnString.append("value=\"" + aChild.hashCode() + "\">");                returnString.append(NSKeyValueCoding.Utility.valueForKey(aChild, childDisplayValueName()));                returnString.append("\n");            }        } else {            // nothing is selected in the parent, so set the children array to all possible child values            // run through all parents, getting each child. However, if we don't have a parentPopUpStringForAll then we only do it for the last parent.            if (parentPopUpStringForAll() != null) {                int iCount = parentEntitiesList().count();                for (int i=0;i<iCount;i++) {                    Object aParent = (Object)parentEntitiesList().objectAtIndex(i);                    //prePendText = aParent.valueForKey(parentDisplayValueName()) + "+";                    NSArray children = sortedChildren(aParent);                    int jCount = children.count();                    for (int j=0;j<jCount;j++) {                        Object aChild = children.objectAtIndex(j);                        returnString.append("\t<option ");                        if ((j == jCount-1) && (selectedChild() == null) && (childPopUpStringForAll() == null)) {                            returnString.append("selected ");                        } else if (aChild.equals(selectedChild())) {                            returnString.append("selected ");                        }                        returnString.append("value=\"" + aChild.hashCode() + "\">");                        //returnString.append(prePendText);                        returnString.append(NSKeyValueCoding.Utility.valueForKey(aChild, childDisplayValueName()));                        returnString.append("\n");                    }                }            } else {                // only do the last parent because we don't have a selected parent AND we don't have the possibility of setting the parent to 'All'                Object aParent = parentEntitiesList().objectAtIndex(0);                setSelectedChild(defaultChildKey()!=null ?                    NSKeyValueCoding.Utility.valueForKey(aParent, defaultChildKey()) : null);                //prePendText = aParent.valueForKey(parentDisplayValueName()) + "+";                NSArray children = sortedChildren(aParent);                int jCount = children.count();                for (int j=0;j<jCount;j++) {                    Object aChild = children.objectAtIndex(j);                    returnString.append("\t<option ");                    if ((j == jCount-1) && (selectedChild() == null) && (childPopUpStringForAll() == null)) {                        returnString.append("selected ");                    } else if (aChild.equals(selectedChild())) {                        returnString.append("selected ");                    }                    returnString.append("value=\"" + aChild.hashCode() + "\">");                    //returnString.append(prePendText);                    returnString.append(NSKeyValueCoding.Utility.valueForKey(aChild, childDisplayValueName()));                    returnString.append("\n");                }            }        }        returnString.append("</select>\n");        if (jsLog.isDebugEnabled()) jsLog.debug("JSPopUpRelationPicker childPopUpString  returnString is " + returnString);        return returnString.toString();    }