Module

Developer
Supported

VWM Surveys

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Victor Michnowicz

     

You must be logged in to post.

Survey Inside All Templates

Support Request

Mutual Designs
Mutual Designs

On our site, we’re trying to implement the ability to create a survey inside any article within the site. Inside the channel editor, we’ve create a channel field called survey_exists to allow publishers to choose whether or not they want to activate the survey template code.

{if survey_exists == "Yes"}
        
            {exp
:vwm_surveys:survey survey_id_or_hash="{survey_id}" redirect="surveys/survey/{url_title}"}
                
                {if in_allowed_group}
                    
<h3>{title}</h3>
                    
{if complete}
        
                        
<p>You have already completed this survey.</p>
    
                    
{if:else}
                    
                        {if progress 
AND current_page == 1}<p>You already have progress in this survey. <a href="{path=">Continue progress</a>.</p>{/if}
                        
<h4>{page_title} (page {current_page} of {total_pages})</h4>
                        <
ul>
                            
{questions}
                                
<li>
                                    <
label for="vwm_surveys_question_{question_id}">{question_title}</label>
                                    
{question}
                                
</li>
                            
{/questions}
                        
</ul>
                        <
div>
                            <
input type="submit" name="save" value="Save Survey" />
                            <
input type="submit" name="submit" value="Submit" />
                        </
div>
                    
                    
{/if}
                    
                {if
:else}
                    
<p>You are not allowed to take this survey</p>
                
{/if}
           
            {
/exp:vwm_surveys:survey}        
        
        {
/if} 

The issue is, even if I set survey_exists to “No” inside the Editor, I get an EE error that the survey does not exist. I’m assuming the exp:vwm_surveys:survey parses before conditional channel entry fields, but I was wondering if there was a a way around this.