Hi Jesse, yes, it is a timesheets, billing, invoicing and reporting
system. Quite fun actually.
Your suggestion about not updating the components unless necessary
was dead on. That took care of a lot of little problems which were
compounding on each other.
I have one last issue though. I have several fields in this dojo
dialog (which is a custom component called AddBillableItem): a
property selection (ie. billableItem), an autocomplete (ie. project)
and some text fields (ie. quantity and total cost). Not all of the
text fields are needed, depending on what you choose as a
billableItem. The billableItem and the project are required. I use an
eventListener on billableItem to change around the text fields. The
component that updates is just an @Any div, which surrounds those
text field components previously mentioned. When it updates however,
the required validation is dropped from the project autocomplete
(even though this component is not updated by the eventlistener).
This is what is sent by the eventlistener, asynchronously:
tapestry.form.registerProfile('addBillableItemEventForm',{"required":
["billableItem","quantity"],"billableItem":{"required":["You must
enter a value for Billable Item."]},"quantity":{"required":["You must
enter a value for Quantity."]}});
whereas on page load it was:
tapestry.form.registerProfile('addBillableItemEventForm',{"required":
["billableItem","project"],"billableItem":{"required":["You must
enter a value for Billable Item."]},"project":{"required":["You must
enter a value for Project."]}});
Note that it is correct that Quantity was added (it's one of those
new fields) - I just don't know why Project was dropped. billableItem
was not updated either, and yet it's validation code correctly
remains intact. If I change Project to a PropertySelection from an
AutoComplete, the correct validation is sent:
tapestry.form.registerProfile('addBillableItemEventForm',{"required":
["billableItem","project","quantity"],"billableItem":{"required":
["You must enter a value for Billable Item."]},"project":{"required":
["You must enter a value for Project."]},"quantity":{"required":["You
must enter a value for Quantity."]}});
Bug?
Thanks,
J
On 16-May-07, at 8:09 PM, Jesse Kuhnert wrote:
Your code looks like mine a couple of years ago only minus any ajax
support. (sounds hospital / billing ish related )
I agree about the server side validation being annoying and am in the
process of fixing it as it has just now annoyed me.
The not updating your form async triggers I'm not as sure about.
Technically the form is being submitted so that is doing its
job....Wouldn't
it be easier to remove the updateComponents parameter on the form
(but leave
the async) and just conditionally update that billable_row if that
particular form submission was really to do some other work?
Just thinking out loud. .
On 5/16/07, Julian Wood <[EMAIL PROTECTED]> wrote:
I have a form:
<component id="addBillableItemEventForm" type="Form">
<binding name="delegate" value="bean:delegate"/>
<binding name="clientValidationEnabled" value="true"/>
<binding name="success"
value="listener:addBillableItemEvent"/>
<binding name="async" value="ognl:true"/>
<binding name="updateComponents"
value="{'weekScheduler_billable_row'}"/>
</component>
<component id="billableItem" type="PropertySelection">
<binding name="displayName" value="literal:Billable Item"/>
<binding name="model"
value="ognl:billableItemSelectionModel"/>
<binding name="value" value="ognl:billableItem"/>
<binding name="validators" value="validators:required"/>
</component>
And I have an eventlistener on billableItem:
@EventListener(elements = "billableItem", events = "onchange",
submitForm="addBillableItemEventForm", async=true, validateForm =
false)
But when you change your billableItem selection, the form still
validates (server side though). It also updates
weekScheduler_billable_row, which I would prefer it not do, since the
only reason I'm submitting this form is to get the selection value of
billableItem. So it seems like the validation may be a bug, and the
updateComponents should be overrideable somehow.
My workaround is to make another form which is populated with the
value from billableItem when it changes, and to submit that using the
event listener.
Thanks,
J
4.1.2-snap from today
--
Julian Wood <[EMAIL PROTECTED]>
Software Engineer
Teaching & Learning Centre
University of Calgary
http://tlc.ucalgary.ca
--
Jesse Kuhnert
Tapestry/Dojo team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
--
Julian Wood <[EMAIL PROTECTED]>
Software Engineer
Teaching & Learning Centre
University of Calgary
http://tlc.ucalgary.ca
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]