Fieldtype

Archived
Forum
(read-only)

VMG Chosen Member

ExpressionEngine 2, ExpressionEngine 3

Back to this add-on's main page
View Other Add-ons From Luke Wilkins

     

Problem displaying field with Channel Form

Support Request

koala kid
koala kid

I’m trying to use VMG inside a Channel Form page on the front end so that a user can search for members amongst a defined set of member groups.

Here’s the code I am using:

{field:safety_member group_id="8|9|10"

However the code is not being parsed and simply displays in the front end as is.

I tried adding {exp:vmg_chosen_member:init_ft type=“css|js”} but was getting an error as the init function was not available with my version of VMG so I’ve upgraded to the latest. Now however I am getting some JS errors:

Uncaught ReferenceErrorjQuery is not defined(anonymous function) @ chosen.jquery.js:24(anonymous function) @ chosen.jquery.js:902
vmg_chosen_member
.js:1 Uncaught ReferenceError: $ is not defined 

As a test I have a simple channel entries tag on the page which outputs correctly, listing the 1 test entry I have in this channel:

{exp:channel:entries channel="safety_training"}
        {safety_member group_id
="8|9|10"}
{
/exp:channel:entries} 

From what I have read it appears VMG should work with Channel Forms. Can anyone let me know why it’s not parsing. I’m using EE 2.7.2.

Thanks.

Luke Wilkins
# 1
Developer
Luke Wilkins

It actually isn’t possible to pass in that list of group IDs in to the {exp:channel:form} field output. Therefore, you’ll want to just set the specific groups available within your field’s settings and then simple use

{field:safety_member} 

to output your field.

If you still have issues after that, please let me know what version of VMG Chosen Member you are using. I’d recommend ensuring that you’re on the latest version so that the

{exp:vmg_chosen_member:init_ft type="css|js"

option is available to you.

Hope that helps!

koala kid
# 2
koala kid

Hi Luke, thanks for the response.

Thanks for the info on the member group, that makes sense.

I’m still getting the JS errors:

Uncaught ReferenceError: jQuery is not defined
vmg_chosen_member.js:1 Uncaught ReferenceError: $ is not defined

I’ve pulled all the code into a completely blank template just in case of clashes with any other plugins but still seeing the issue. Here’s what I have:

{exp:vmg_chosen_member:init_ft type="css|js"}

      {exp
:channel:form 
            channel
="safety_training" 
            
return="/account/logbook"
            
        
}

        
<div class="form-group row">
            <
label class="col-xs-3 main-label">Instructor</label>
            <
div class="col-xs-6">  
                
{field:safety_member}
            
</div><!-- /select_customer-->
        </
div>  

    
        <
div class="form-group row">
            <
label class="col-xs-3 main-label">&nbsp;</label>
            <
div class="col-xs-9">
                <
button class="red butt">Approve</button>
            </
div>
        </
div>
      
{/exp:channel:form} 

VMG - v2.1
EE - v2.7.2

Luke Wilkins
# 3
Developer
Luke Wilkins

Ah, ok. It looks like jQuery probably isn’t loaded on your page. In most cases, it looks like EE does this by default when using `{exp:channel:form}`.

Can you try including jQuery right before your `{exp:vmg_chosen_member:init_ft}` tag?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

koala kid
# 4
koala kid

Hi Luke,

my bad, I was including VMG init call before the include for jQuery. I appreciate your help in getting this worked out.

Thanks.

Luke Wilkins
# 5
Developer
Luke Wilkins

No problem! Glad you were able to get it working.

Best,
Luke