I've used a messy kludge in situations like this. Messy... kludgy.... but it /does/ work. =) The gist of the idea is that you render your form fields like normal, using the list edit. You also render a @Hidden field (make sure to set the "encode" property to false). Now you use DOM to add your fields, and add a javascript event to the submit button. The job of the submit button is to collect all of the information from the auto-generated fields, and store in the hidden field in a manner which will be parsable on the server (for example, you could store it in a string of the form: key:value;key:value;key:value;key:value). Now when everything renders on the server, you'll have all of your tapestry-saved fields, plus a string storing all of the DOM-added fields; in your form listener (called after the form is done with it's rewind phase, so you're "safe" from stale form exceptions), parse out the values in the string and create the "real" objects associated with the key/value pairs. Then, when tapestry re-renders the page, all of the newly added elements will be proper tapestry components. Note that this has the pitfall of the user adding a bunch of fields, then leaving the page without ever doing a "real" save, thereby losing their work. But... it's a step in the right direction. You could, for instance, use something similar to the tacos "dirty form" component to make sure that the user doesn't leave the page without performing a "real" save. Anyway... like I said... a bit messy, very kludgy... but it works. :)
Robert > Question: > If I have a ListEdit (in Tapestry 3) wrapped in a custom component for > displaying some name/value textfield pairs, and want to give the user > the ability to quickly add more pairs of fields, can I fake out the > rewind phase by naming the fields smartly and updating the hidden field > used to track "staleness" in the form? > > It seems that if I'm only going to be looping thru the fields in this > subcomponent anyway, then why should Tapestry care too much about how > many fields there are? > > My objective is to be able to use Javascript to instantly add more > fields, without having to unwind-increment-re/render the entire page. > It's really a poor user experience to force that trip to the server. > Plus, it's a real pain to try and sync up Tapestry's validation JS and > other client-side state mechanisms and display widgets for my particular > design. This seems a great case for easy DOM manipulation, but is not > so easy to handle on the server side with Tapestry. > > What's the best way to approach this? Is there any examples extant? > > </bd> > > --------------------------------------------------------------------- > 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]