javascript - typeAhead for default values on click -
nice use case edit fields type ahead allows click empty field or use alt+down shortcut, , list of recent/default values provided. user not need guess letter type , has useful list of choices start with.
question: how can invoke field's typeahead partial refresh event when user enters/clicks empty field, or uses alt+down? expect submited variable defined "var" property empty, handle in code proper choices.
<xp:inputtext id="inputtextlookup" styleclass="lotustext" value="#{viewscope.znalostilookup}"> <xp:typeahead mode="partial" minchars="1" var="valuetolookup" ignorecase="true" preventfiltering="true" valuemarkup="true" maxvalues="10"> <xp:this.valuelist><![cdata[#{javascript:return options(valuetolookup);}]]></xp:this.valuelist> </xp:typeahead> </xp:inputtext>
you can f.e. using onfocus event of inputtext field.
<xp:eventhandler event="onfocus" submit="false"> <xp:this.script> <![cdata[ var typeahead = dijit.byid('#{id:inputtextlookup}'); typeahead._startsearch("onfocus"); ]]> </xp:this.script> </xp:eventhandler>
the parameter of _startsearch() method value send server.