Company Directory - can I add contact forms ?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
Darwin Web Design
Forum Members
Forum Members
Posts: 212
Joined: Tue May 30, 2006 3:12 am
Location: Darwin NT, Australia

Company Directory - can I add contact forms ?

Post by Darwin Web Design »

Hello
I'm using CMSMS 1.9.4.1 and Company Directory 1.8.1. and FormBuilder 0.7.

My client would like only some of the businesses in the company directory to have a unique contact form within the description area of the directory listing. Some of the businesses wont have a form at all and others would need a form to say, book a tentative appointment or make a product enquiry. So I unfortunately can't apply a generic form to ALL listings in the main template as the forms will differ depending on the type of business, - so ideally I would need to call up the form reference tag in the relevant businesses listing/description field.

I have tried for example adding {FormBuilder form='contact'} to one of the businesses in the directory, but this does not generate the form like on a normal page - but just displays that code. I tested the same tag on an ordinary page and it displays the form fine.

I assume because the content area in the company directory template differs to ordinary templates or pages? And we cannot use the normal CMSMS tags wrapped in {brackets} in the company directory description area?

I also tried wrapping the code in <literal> tags, but this didn't help.

Is it at all possible to achieve this? And if there is a way to do this (I'm a designer not a developer so hopefully something simple) would be glad to hear of any advice.

Many thanks
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Company Directory - can I add contact forms ?

Post by jmcgin51 »

you need to use Smarty eval to do this
User avatar
Darwin Web Design
Forum Members
Forum Members
Posts: 212
Joined: Tue May 30, 2006 3:12 am
Location: Darwin NT, Australia

Re: Company Directory - can I add contact forms ?

Post by Darwin Web Design »

Right... thanks for the clue but could you explain a little more. I'm a designer not a programmer ... Is there a simple line of code I can use or is this something only a programmer will have to do?

I looked on the smarty website to work it out myself and have tried the following on a company directory description area:

- {eval var=$entry->FormBuilder form='contact'} and then I tried,

- {$entry->FormBuilder form='contact'}

But both of these things only display the code, not the actual form.

Thanks.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Company Directory - can I add contact forms ?

Post by jmcgin51 »

First you need to create the variable to be eval'd.
{capture assign='form'}{FormBuilder form='contact'}{/capture}

then eval it
{eval var=$form}
User avatar
Darwin Web Design
Forum Members
Forum Members
Posts: 212
Joined: Tue May 30, 2006 3:12 am
Location: Darwin NT, Australia

Re: Company Directory - can I add contact forms ?

Post by Darwin Web Design »

Thank you ...

I have tried putting both of these lines of code in both the Company Directory template and also tried in the actual Directory listing details section - both of these methods don't display the form but just the tags.

I know it might sound obvious to a programmer, but can you tell me where to put the code exactly, as I'm just guessing and what I'm trying isn't working. Do I still use the tag {FormBuilder form='contact'} - anywhere?
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Company Directory - can I add contact forms ?

Post by jmcgin51 »

you will put both lines of code in your CompanyDirectory details section. I had to do something similar a year or so ago, except I was using the Uploads module, not FormBuilder.

http://forum.cmsmadesimple.org/viewtopi ... ic=35141.0
User avatar
Darwin Web Design
Forum Members
Forum Members
Posts: 212
Joined: Tue May 30, 2006 3:12 am
Location: Darwin NT, Australia

Re: Company Directory - can I add contact forms ?

Post by Darwin Web Design »

Your example a year ago sounds very similar to what I am trying to achieve.

I put the following on the bottom of my detail text for one company:

{capture assign='form'}{FormBuilder form='contact'}{/capture} {eval var=$form}

and it still only just prints that code instead of the form on the actual page when you visit that company on the website.

Thanks for your patience but I must be missing something?
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Company Directory - can I add contact forms ?

Post by jmcgin51 »

hmm, that's odd. I just tested on my site, adding a FormBuilder tag to a CompanyDirectory details field, and it displayed correctly, even without eval.

can you pm me temporary admin credentials?
User avatar
Darwin Web Design
Forum Members
Forum Members
Posts: 212
Joined: Tue May 30, 2006 3:12 am
Location: Darwin NT, Australia

Re: Company Directory - can I add contact forms ?

Post by Darwin Web Design »

Thanks for getting back to me and helping with this.

I haven't installed it to the remote hosting server yet - just working on it locally as its a large-ish site that needs lots of upgrade work done.

Do you think perhaps it is not working because I have the website set up on my server on my laptop using wamp?
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Company Directory - can I add contact forms ?

Post by jmcgin51 »

that's a possibility, though I'm not sure why it would matter. Do you have a live site that you could add a test install of CD and give it a quick try. 20 minutes should tell you if it will work in your production/hosted environment.
User avatar
Darwin Web Design
Forum Members
Forum Members
Posts: 212
Joined: Tue May 30, 2006 3:12 am
Location: Darwin NT, Australia

Re: Company Directory - can I add contact forms ?

Post by Darwin Web Design »

Yes, I have the old version online now with CMSMS and Company Directory - but not yet the form module. I've just downloaded it all to upgrade to the latest version of CMSMS and modules + new formbuilder.

I'll PM you a login, hopefully you can see what's going on without the formbuilder module installed? - thank you.
Post Reply

Return to “Modules/Add-Ons”