code: public static String findComponentFormId(FacesContext fc, UIComponent c) {
  		UIComponent parent = c.getParent();
  
  		while (parent != null) {
  			if (parent instanceof UIForm) {
  				return parent.getClientId(fc);
  			}
  			parent = parent.getParent();
  		}
  		return null;
  	}
docs: Finds the Form Id of a component inside a form.
  
  @param fc
  FacesContext instance
  @param c
  UIComponent instance
  @return