ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

displaying different contact form depending on category

June 21, 2007 7:24am

Subscribe [2]
  • #1 / Jun 21, 2007 7:24am

    open-box

    11 posts

    Hi there,

    i dont know how to explain this properly even though i know what i want..

    i have four categories in a weblog called ‘add_service’

    the 4 categories are - call solutions | installation | leasing | telephone systems.

    ive added information into each service.

    Once i click on a category link such as ‘telephone systems’ it displays all telephone systems in that category.

    there is a ‘find out more’ link.

    Once this is clicked, i want to display a contact form that has custom fields only for the phone systems category.

    Now, i only want to show this custom form only when someone clicks on read more’ for the phone system category, but the contact form appears for all categories.

    Can someone please advise me on how i can hide this form from the other ‘read more’ pages for the other 3 categories?

    Here is the link http://www.apnacom.com/index.php/online_services/

    Ive added dummy services for phone systems, and installation for now.

    Please help, thanks.

    Moved by Moderator to HowTo

  • #2 / Jun 21, 2007 7:42am

    Sue Crocker

    26054 posts

    Realistically, I’d probably use Solspace’s Freeform Module for this.

    You’d check for segment_3, and based on the segment, display a Freeform form.

    Does that make sense? Working with the Freeform module gives you a much greater method for doing this. Plus you’ll get a log of forms filled out, which will be helpful.

    But it will require you to have some knowledge on setting up forms in general.

  • #3 / Jun 21, 2007 7:44am

    open-box

    11 posts

    Hi sue,

    i am using the Freeform module.

    I just dont know how to implement it for the above requirements.

    Any help would be appreciated.

    Thanks.

  • #4 / Jun 21, 2007 7:55am

    Sue Crocker

    26054 posts

    Well, at this point you’re leaving the realm of tech support, and heading over to HowTo.

    Basically the way I would handle it would be to have a template group with each of the valid choices in it.

    Then do an embed for the template associated with segment_3.

    So in one example, if segment_3 was 13, you’d do this:

    {embed=templategroupname/{segment_3}}

    Where you’d have created a form and put it in templategroupname/13.

    Does that make sense?

  • #5 / Jun 21, 2007 8:04am

    open-box

    11 posts

    Hi sue,

    the only problem with tha is, each time i add a product, a new segment 3 number is created that i have to account for.

    I was wondering if i can display this form only for items that are in a particular category?

    Because all phone systems are in the ‘phone systems’ category - is there an ‘if’ statement that will go with {category_id} just to display the form in items in that category, and will this work?

    Thanks.

  • #6 / Jun 21, 2007 8:39pm

    open-box

    11 posts

    Hi, does anyone have any clue where i’m going wrong?

    I’be tried to achieve the above, where i want a contact form to appear only when an item is added into the ‘phone_systems’ category, which has the ID number 18 assigned to it.

    I’ve tried the following -

    {exp:weblog:entries weblog="add_service" }
    {categories}
    {if category_id == "18")

    {embed="embeds/contact_form"}

    {/categories}
    {/exp:weblog:entries}

    But nothing displays on the page.

    Can someone please help.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases