Thanks Anthony for stepping up.

I have a views file, it has quite a chunk of html in it. If I could put it 
in the controller, I would, but it's quite hefty.

I have about 15 fields, displayed via SQLFORM, just a simple 
form = SQLFORM(db.table)

I want to insert a {{include html_file}} in the middle, and I've tried
form[0].insert(7,'{{include "template.html"}}')
but of course it didn't work out (it just printed the string in the correct 
place).

I have two choices from what I can tell,
1 - to manually code each field in views
2 - find a way to insert the html template file (hence my question here)

Please let me know if it would be worth the effort (as I can tell from your 
reply, it may get messy), or I should just hand code the fields.
Or perhaps, is there a way to "unload" the fields manually, like 
for field in form:
   print field #I can find some way to do this 7 times,use the include,then 
"unload" the rest of the fields

Thanks!


On Saturday, September 8, 2012 10:26:37 PM UTC+8, Anthony wrote:
>
> If you are building a custom form in the view, then yes, you should be 
> able to do an include in the middle of it. If you just have the SQLFORM 
> object and want something inserted when it is serialized in the view, it's 
> trickier but probably doable (need to call response.render() and insert the 
> result via server-side DOM). Can you show more details?
>
> Anthony
>
> On Saturday, September 8, 2012 7:01:27 AM UTC-4, lyn2py wrote:
>>
>> I have a SQLFORM with many fields. I want to insert a html file (like 
>> {{include abc.html}} in views) into the middle of the form. 
>>
>> Can I do that?
>>
>

-- 



Reply via email to