1 Reply Latest reply on Mar 2, 2007 2:36 PM by Damian Harvey

    Pre-filling IceFaces SelectInputText

    Damian Harvey Master

      I am trying to populate a SelectInputText (auto-complete) field for when a user edits a record. The SelectInputText works fine however I need the current value to be displayed when a user goes in to edit the record.

      I have followed the advice from this thread: http://www.icefaces.org/JForum/posts/list/3718.page

      But get a NullPointer as my method can't find the JSF component.

      My JSF page has a form (<h:form id="scheduleDate">) and in that form is the SelectInputText component (<ice:selectInputText id="unlocode"...)

      My code to populate this component is:

      //Set the list of matches to the incoming value
      selectList.add(new SelectItem(scheduleDate.getUnLocode(), scheduleDate.getUnLocode().getName()));
      //Find the JSF component from the page
      SelectInputText sit = (SelectInputText)FacesContext.getCurrentInstance().getViewRoot().findComponent("scheduleDate:unlocode");
      //Set the selected item on the component (this is where the null pointer occurs

      Am I correct in the notation of "scheduleDate:unlocode"?
      Has anyone got a working example of this sort of thing?