happycog / VMG-Chosen-Member

VMG Chosen Member - Fieldtype for Expression Engine 2 and 3
http://vectormediagroup.com
23 stars 11 forks source link

Channel form #14

Closed glencampbell closed 9 years ago

glencampbell commented 10 years ago

Hi, After updating to EE 2.8 (and channel forms), the field isn't populating on a Channel Form – I'm using Stash variable to stash the member_id in the "course_reps_member" Chosen Member field (which is hidden to the user). None of my code has changed and was working fine before the upgrade.

The member_id is populating in the value attribute (as below), but when I submit, and then go to control panel and check the new entry, the Chosen Member is blank.

This is my code rendered in channel form, with member_id 1748:

<div class="vmg-chosen-member-container">
    <select id="vmg_chosen_member_114_0_0_0" name="course_reps_member[]" class="vmg-chosen-member" rel="114_0_0_0">
        <option value="1748" selected="selected">1748</option>
    </select>
    <input type="hidden" id="vmg_chosen_member_114_0_0_0_field_id" value="114">
    <input type="hidden" id="vmg_chosen_member_114_0_0_0_col_id" value="0">
    <input type="hidden" id="vmg_chosen_member_114_0_0_0_var_id" value="0">
    <input type="hidden" id="vmg_chosen_member_114_0_0_0_max_selections" value="">
    <input type="hidden" id="vmg_chosen_member_114_0_0_0_placeholder_text" value="Begin typing a member's name...">
    <input type="hidden" class="vmg_chosen_member_json_url" value="http://my-domain/?ACT=31&amp;field_id=114&amp;col_id=0&amp;var_id=0">
</div>
mrw commented 10 years ago

Thanks @glencampbell. I'm going to ping @lukewilkins on this, though note it may be a bit before he can respond!

glencampbell commented 10 years ago

Thanks mrw, much appreciated. I went live without the change for now! One of many nightmares upgrading to 2.8 and introducing Structure – which leads me to my next point, I poss should have mentioned, the templates are under Structure control (but not sure whether this would have anything to do with it).

Another thing I noticed – when I have Zenbu displaying the field in its edit table, it is showing the member ID OK, but then when you open the publish form the VMG member field is not populated.

Thanks for your help G

glencampbell commented 10 years ago

@lukewilkins @mrw Did you guys ever get round to testing this? Still no luck with it myself. Using the above code (which is hidden to the user) is not populating the member field from a Channel Form. Is there something I am missing?

Many thanks guys

lukewilkins commented 10 years ago

@glencampbell Sorry for the delay. I just tested this with Channel Form, but am not seeing any issues. I've updated the README with some information regarding assets with loading the fieldtype outside of the Control Panel. Can you try adding that {exp:vmg_chosen_member:init_ft type="css|js"} tag to your page and see if that makes a difference?

Also, you mentioned that the field is hidden from users on that page. Can you check web inspector to see if the course_reps_member field is actually being submitted with data?

glencampbell commented 10 years ago

Hi @lukewilkins

Tried this, which successfully brought the scripts and style links into the head – which all link fine to the files. No console errors.

I used the field code above

My field looks like this (as you can see has selected the member ID):

image

This is coming out in the head:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://example.com/themes/third_party/vmg_chosen_member/chosen/chosen.css" />
<link rel="stylesheet" type="text/css" href="http://example.com/themes/third_party/vmg_chosen_member/vmg_chosen_member.css" />
<script type="text/javascript" src="http://example.com/themes/third_party/vmg_chosen_member/chosen/chosen.jquery.js"></script>
<script type="text/javascript" src="http://example.com/themes/third_party/vmg_chosen_member/vmg_chosen_member.js"></script>

And as above this is my code (My member custom field ID is 114, my member ID is 1834)…

<div class="vmg-chosen-member-container">
    <select id="vmg_chosen_member_114_0_0_0" name="course_reps_member[]" class="vmg-chosen-member" rel="114_0_0_0">
        <option value="1834"  selected="selected">1834</option>
    </select>
    <input type="hidden" id="vmg_chosen_member_114_0_0_0_field_id" value="114">
    <input type="hidden" id="vmg_chosen_member_114_0_0_0_col_id" value="0">
    <input type="hidden" id="vmg_chosen_member_114_0_0_0_var_id" value="0">
    <input type="hidden" id="vmg_chosen_member_114_0_0_0_max_selections" value="">
    <input type="hidden" id="vmg_chosen_member_114_0_0_0_placeholder_text" value="Begin typing a member's name...">
    <input type="hidden" class="vmg_chosen_member_json_url" value="http://example.com/?ACT=31&amp;field_id=114&amp;col_id=0&amp;var_id=0">
</div>

Am I doing anything wrong with this setup?

Many thanks @lukewilkins G

mrw commented 10 years ago

Just curious, are you on an HTTPS page @glencampbell?

glencampbell commented 10 years ago

No @mrw just standard HTTP. Uses Stash and is now within Structure module. But all other form fields submitting fine.

Just to note: When I use Zenbu to display the member field on the edit page / entry listing, it is showing the Member ID, but when I visit the publish page the VMG Chosen Member field is blank. So the ID is going through, but not working as should. Makes me wonder is it a display issue, rather than a Channel Form issue?

glencampbell commented 10 years ago

@mrw Any ideas to test on this? I was wondering, as I know this is a free add-on and hate pestering you guys, would it be possible to get paid-for support? (I would need to clear this with the client first)

So where I am at is: the member ID is coming into the field from the Channel Form. This Member ID is visible using Zenbu for displaying entries list (the field shows the member ID on it's own). But on the Publish Form the member field is blank. So, the associated ID is there OK, just not linking and displaying the member. All my code so far is above.

The issue I am in at the moment is this is a live site, waiting for user registration of over 1000 students. So the client is holding back on inviting these registrations until this works (I have this hooked into MX Notify to send an email once the entry is created. And the email is an essential part of the flow). Problem only started occuring on upgrade to 2.8.

Thanks a million guys

mrw commented 10 years ago

@glencampbell Do you mind either sending me your email address, or emailing me? I'm matt [at] vectormediagroup [dot] com. Maybe we can get access to the server and check it out.