On Apr 16, 2007, at 6:16 PM, George Sakkis wrote:
(...)
>
>>> Initially I was doing it all in
>>> Javascript, without any redirect, but it was messy and it  
>>> essentially
>>> replicated the way TG fills in automatically a form given a  
>>> model. Is
>>> there a better pattern for incrementally filling a form ?
>>
>> I would do it client-side with javascript. In what sense was it  
>> messy?
>
> As I said, it replicates the form filling logic that comes for free
> with TG. Example: given an ID for some model, fetch (using JSON) the
> respective record (and perhaps other children records), and for each
> field of the record find the respective form widget and fill in the
> respective value in the appropriate way for the widget (e.g. for a
> text field set the value attribute, for a textarea set innerHTML,
> etc.). Add nested and repeating widgets in the mix and you have a very
> messy, semi-working javascript clone of TG.widgets :)

Yep, that's messy. I though you were aiming a something simpler like  
updating a select field or such... :/

>
> It would be useful though if this part of TG was ported in javascript
> in a generic, reusable way, but my knowledge of the language is very
> limited so I can't tell if it's even possible.

There's a thread going on discussing the possibility of a js template  
engine... If that ever comes into existence and is compatible with  
Buffet, it should be easy to integrate into TW... anyway, dreaming is  
easy... :)

Alberto

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to