Custom Form

Permalink
Hi guys,

I am building a art gallery website and was wondering if anyone has built or if it is at all possible having a dynamic enquiry form for each art piece. Meaning, is it possible to use one block, that has a dynamic field that is updated with the artworks name. So that the user can send an enquiry only for that art work.

Any help would be much appreciated.

cheers,
Ritchie

 
olsgreen replied on at Permalink Reply
olsgreen
Hi,

Yes it is possible, I have done exactly what your asking for.

I made a custom template for the form block and wrote some code to detect the page name and insert the field?

$p = Page::getCurrentPage();
$page_name = $p->getCollectionName();


Custom Templates:http://www.concrete5.org/documentation/general-topics/custom-templa...

KR

O
roa123 replied on at Permalink Reply
Thanks for the tip. Can I ask how you integrated the form block into your template? I'm assuming you added your form block in programmatically. Actually how would you do that?
jordanlev replied on at Permalink Reply
jordanlev
Hi roa123,
In my experience, you cannot embed form blocks directly into templates -- if you try to do so, submitting the form doesn't work. Your best bet is going to be adding the form to the Page Defaults for your page type (seehttp://www.concrete5.org/help/editing/scrapbook_defaults/... ).