On Mar 21, 2007, at 6:18 AM, iain duncan wrote:
>
> On Wed, 2007-21-03 at 06:13 +0100, Alberto Valverde wrote:
>>
>> On Mar 21, 2007, at 4:50 AM, iain duncan wrote:
>>
>>>
>>> So, in my mucking about with integrating widgets and ajax, I just
>>> discovered that the widget forms do not ouput valid xhtml! None
>>> of the
>>> input tags are closed. I discovered this because it was choking the
>>> update function in ajax.js. And on checking the output of a rendered
>>> form page ( which I was trying to dump into a dom element ) I see
>>> all
>>> the input tags in remote form and table form are like so:
>>>
>>> <td><input blah blah ></td>
>>>
>>>
>>> This means that we can not render them and then pass around that
>>> output
>>> through templates. So you can not render a form widget and pass the
>>> rendered version to kid to display as:
>>>
>>> ${XML( rendered_widget ) }
>>>
>>> I assume this is not supposed to be the case? Anyone know how to
>>> fix it
>>> in the short term through a custom template?
>>
>> They render valid html if kid is configured to do so in the config
>> file. To make a particular widget output xhtml do:
>>
>> widget.render(format='xhtml')
>>
>> However, I'd recomend using display instead of render as it outputs
>> an element stream which is more efficient than serializing and re-
>> parsing with XML.
>
> Given that kid demands valid xhtml, is there any reason not to have
> the
> widgets default to format xhtml?
TG widgets use the same view engine as normal page templates in TG
use so any options you pass it via the config file will affect both
widgets and page templates (this is not the same in TW which uses
it's own engines wich can be configured independently)
Anyway, using render in kid templates is not a good idea.
Widget.display returns an Element tree that can be embedded directly
in a kid template. When you render a widget you're serializing that
element tree and then, by passing it through XML, parsing it into
another element tree.
The render method is only really needed when you want to place a
widget in a "string" template (cheetah, mako, etc...) or to view the
markup in an interactive interpreter for debugging.
Alberto
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---