sourcforge > sotacs
 

Most simple use of AjaxTextField

The textfield pops up a selectable list of names from the telephone book that start with the entered text.

(TelephoneBook.java, TelephoneBookEntry and phonebook.txt are some helper classes / ressource, that are used in the examples to AjaxTextField)

Screenshot

simple list

Note
This is static documentation. You can see this example live

Simple.html

			
<form jwcid="@Form">
	<input type="text"  jwcid="@sotacs:AjaxTextField"  
		size="20"  
		items="items:completeFirstName" value="literal:"
	/> 
</form>

	    

Simple.java

			
public abstract class Simple extends BasePage {
	
	public void completeFirstName(ItemWriter writer, String prefix) {	
		if (prefix.trim().length() == 0)
			return;
		List<TelephoneBookEntry> results = 
			TelephoneBook.getInstance().
			    getEntries(TelephoneEntryField.FIRSTNAME,prefix);
		for (TelephoneBookEntry entry : results) {
			writer.writeSimpleItem(entry.getFirstName());
		}
	}
}