Hi samlai,

you should be able to bind an EventListener to the ServerRegion-Field (onChange 
or onSubmit should be your choice). This Listener can trigger an AJAX-Request 
and so you should be able to update the Automcomplete-Model. (Don't know the 
exact syntax, but some JavaAnnotation should handle this.) 

I suppose you then need the AutocompleteModel to be server-based instead of 
client-based as I suspect a changed AutocompleteModel will not be automatically 
shipped to the client.

Grz
andi



-----Ursprüngliche Nachricht-----
Von: samlai [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 4. März 2008 08:15
An: users@tapestry.apache.org
Betreff: Autocomplete Using Selection as Criteria


I have an autocomplete textfield.  I'd like the retrieved autocomplete list to 
be based from a selection field in addition to the autocomplete textfield.  I'm 
not sure how I can feed the current server region selection to 
onProvideCompletionsFromServerNameField, serverRegionField is null before 
submit.  Thanks.

NewUser.java
==========
public class NewUser {
...
        private String serverRegionField;
        private String serverNameField;

        @Component(id = "serverNameField")
        @Mixins("Autocomplete")
        private TextField serverNameText;

        String[] onProvideCompletionsFromServerNameField(String input) {
                Dao dao = Dao.getRequestInstance(requestGlobals);
                Query query = 
dao.createNamedQuery("findServerNameLikeForRegion");
                query.setParameter("name", input + "%");
                query.setParameter("region", serverRegionField);

                List<String> serverNameList = (List<String>) 
query.getResultList();
                return serverNameList.toArray(new 
String[serverNameList.size()]);
        }
...
}


NewUser.tml
=========

<div id="newUserView" class="mainpost">
                <t:form t:id="newUserForm">
                        <t:errors />
                        
                        <div class="t-beaneditor">
                                <div class="t-beaneditor">
                                        <div class="t-beaneditor-row">
                                                <t:label for="emailField" />
                                                <t:textfield t:id="emailField" 
t:validate="required,regexp" size="30"
/>
                                        </div>
                                        <div class="t-beaneditor-row">
                                                <t:label 
for="serverRegionField" />
                                                <t:select 
t:id="serverRegionField" t:model="literal:US,EU"
t:validate="required"/>
                                        </div>
                                        <div class="t-beaneditor-row">
                                                <t:label for="serverNameField" 
/>
                                                <t:textfield 
t:id="serverNameField" t:validate="required" size="30"/>
                                        </div>
                                        <div class="t-beaneditor-row">
                                        <t:submit t:id="registerButton" 
value="Register"/>
                                        </div>
                            </div>
                    </div>
            </t:form>
    </div>
--
View this message in context: 
http://www.nabble.com/Autocomplete-Using-Selection-as-Criteria-tp15821577p15821577.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to