I have three Select components and a TextField component on my form (customerSelect, locationSelect, deviceSelect, problemTextField). What is supposed to happen is when the user selects a customer the locationSelect component should be filled with the locations associated with the selected customer. I attempted this using the onEvent mixin and a javascript function, but Tapestry kept telling me my javascript function was undefined.

I decided to simplify and eliminate the OnEvent mixin and use onchange instead. The problem is onchange doesn't seem to allow Tapestry to persist any of the form fields.

Now I am using a combination of both OnEvent and onchange. Using this approach the customerSelect component persists I think because of the OnEvent mixin, but the other components reset every time a new customer is selected.
Here is the customerSelect definition from my tml file.
<select t:type="select" t:id="customerSelect" t:model="selectModelCustomers" t:encoder="selectModelCustomers" t:value="selectedCustomer" t:mixins="commons/OnEvent" event="change" onchange="document.forms[0].submit()">

I am hoping someone can point me in the right direction if there is a more conventional way of updating a form based on a user's actions. Otherwise maybe help me find the reason my current approach isn't working. I can include more code if that will help to better understand what I am requesting.

The only other thing is if I initialize the customerSelect in onActivate the select is always one selection behind (ie. I choose a customer and when the page refreshes the select component is not updated, I then choose a different customer and the select is updated with my first selection... ) -- probably because of my use of onchange. So instead I am initializing it in the java page's constructor and that fixed the delay problem. If anyone has any insight regarding this I would love to hear it.

I would love for this to work with AJAX using the OnEvent mixin and an onCompleteCallback javascript event, but it doesn't have to. Submitting the entire form to update the necessary components is acceptable for this project.

Thank you,

Jayson Pierringer


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to