On 5/3/2010 3:27 PM, Robert Morley wrote:

On May 3, 2010, at 6:17 PM, Scott Gray wrote:

I haven't had a good look in a while but I thought FreeMarker
templates were used to render surveys?


This is from memory for me too; but I believe what happens is
FreeMarker templates are used to create xml that represents a
ModelForm. The survey logic than instantiates an instance of
ModelForm from this dynamically generated xml and (I think) stores it
in the context. When the survey is rendered the survey screen
includes this dynamic form instance using the context:// notation and
standard html rendering takes over. I may have that context usage a
bit wrong ... but I remember creating some ftl to handle additional
field-types that I wanted to render as part of my survey.

I remember thinking it might have been better to instantiate a
ModelForm and then set the appropriate attributes / fields / etc on
it, rather than the FreeMarker usage and generate xml, and then suck
that in to result to the same place ... an instantiated form instance
... but I never acted on that thought. :)

All very interesting :-) but if I look at genericsurvey.ftl for
example, it's just generating straight up html

Regardless, what you're suggesting is an order of magnitude more work
than what I've proposed so whether it's a nice feature or not, I won't
be implementing it :-)

Regards
Scott


Bah Mr. Gray! I think what I was referring to was genericsurveyform.ftl.
Oh dammit! I think this is something I must have implemented a year ago
and only exists in our project LOL ... Oh now it is coming back; we
wanted to make use of party lookups (with ajax) and such in the forms,
so it made sense to change the ftl to render a form and then leverage
the standard form renderer. I am so sorry; this was custom work I had
done that I thought was OOB Ofbiz.

Any interest in it? ;)


I think there is some work being done to make the widget macros reusable - so plain templates can use the widget goodies.

-Adrian


Reply via email to