[jboss-user] [JBoss Seam] - Pre-filling IceFaces SelectInputText

damianharvey do-not-reply at jboss.com
Fri Mar 2 11:36:24 EST 2007


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
  | sit.setSelectedItem(scheduleDate.getUnLocode().getLocode());
  | sit.setValue(scheduleDate.getUnLocode());
  | 

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

Thanks,

Damian.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024688#4024688

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024688



More information about the jboss-user mailing list