On May 3, 2010, at 5:53 PM, Scott Gray wrote:

What I am getting at here is an ability to model a "validation service" as part of the ModalForm. How it is implemented (sever- side vs. ajax callback) would really be secondary. I like the ajax approach for the validation that you have suggested in the implementation ... I was just thinking if you were going to add validation logic to your survey you could expose that through an extension to the ModelForm
(since that is what survey is creating dynamically)

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. :)

Reply via email to