NS_RELEASE(control);
void nsForm::Init(PRBool aReinit){  if (mInited && !aReinit) {    return;  }  mInited = PR_TRUE;  RemoveRadioGroups();  // determine which radio buttons belong to which radio groups, unnamed radio buttons  // don't go into any group since they can't be submitted. Determine which controls  // are capable of form submission.  PRInt32 textCount = 0;  nsIFormControl* textControl = nsnull;  int numControls = GetFormControlCount();  for (int i = 0; i < numControls; i++) {    nsIFormControl* control = (nsIFormControl *)GetFormControlAt(i);    nsString name;    control->GetName(name);    PRBool hasName = name.Length() > 0;    nsString type;    control->GetType(type);    // count text for determining "return" submission     if (type.EqualsIgnoreCase("text")) {       textCount++;      textControl = control;    }    // radio group processing    if (hasName && (type.Equals(*nsInputRadio::kTYPE))) { // XXX make constant consisten with above      int numGroups = mRadioGroups.Count();      PRBool added = PR_FALSE;      nsInputRadioGroup* group;      for (int j = 0; j < numGroups; j++) {        group = (nsInputRadioGroup *) mRadioGroups.ElementAt(j);        nsString groupName;        group->GetName(groupName);        if (groupName.Equals(name)) {          group->AddRadio(control);          added = PR_TRUE;          break;        }      }      if (!added) {        group = new nsInputRadioGroup(name);        mRadioGroups.AppendElement(group);        group->AddRadio(control);      }      // allow only one checked radio button      if (control->GetChecked(PR_TRUE)) {	      if (nsnull == group->GetCheckedRadio()) {	        group->SetCheckedRadio(control);	      }	      else {	        control->SetChecked(PR_FALSE, PR_TRUE);	      }      }    }    NS_RELEASE(control);  }  // if there is only one text field, it can submit on "return"   if (1 == textCount) {     textControl->SetCanSubmit(PR_TRUE);  }}