I'm having trouble displaying two Playa single select fields in a SafeCracker form that is dynamically loaded via Ajax with jQuery. I have tried everything suggested in P&T's Get Satisfaction support area, but nothing's working.

Here is my case:

I have a channel named Orders and a channel named Traders. When I make a new order, I want to assign a Buying trader and Selling trader via a Playa field.

I have a site/index template that is loading orders/_orders template via ajax.

In the order/_orders template is a exp:channel:entries loop wit all my Orders. There is also a SafeCracker form around 3 checkboxes in each order.

Every order has an Edit button, that, when clicked, loads a SafeCracker form for that particular Order via Ajax. The template is: orders/_order-editForm/{entry_id}

The edit Order form containing the SafeCracker form holds two Playa single select fields which are embedded like this (one for Buyers and one for Sellers):

<select class="chzn-select" name="buyer_trader[selections][]" style="width:200px;">
{embed='orders/_order-buyer-dropdown' entry_id="{buyer_trader}{entry_id}{/buyer_trader}"}


<select class="chzn-select" name="seller_trader[selections][]" style="width:200px;">
{embed='orders/_order-seller-dropdown' entry_id="{seller_trader}{entry_id}{/seller_trader}"}

As you can see I'm embedding the entry_id of the selected buyer and seller to set the corresponding buyer and seller as 'selected' in the select field inside the embedded template.

Inside the orders/_order-buyer-dropdown and orders/_order-seller-dropdown templates, I have the exp:channel:entries loop like this:

{exp:channel:entries channel="traders" dynamic="no" disable="categories|member_data|pagination"}
<option value="{entry_id}" {if "{entry_id}" == "{embed:entry_id}"}selected{/if}>

The issue is dat the selected Traders are not showing the right trader. The orders Are showing the correct trader. On submitting the forms everything IS working. And the correct Traders Are being submitted. The only issue (that I have been tackling for the past 3 days) is that when I want to edit an order, the select boxes are not showing the correct traders as 'selected'.

The only way I do get it to work is when I use {field:buyer_trader} / {field:seller_trader}, except I shows me the Playa styled version of the select box, and I don't want that.

What am I doing wrong?

  • I have actually narrowed it down to that {buyer_trader}{entry_id}{/buyer_trader} and {seller_trader}{entry_id}{/seller_trader} both outputting the same entry_id. {buyer_trader} and {seller_trader} are my Playa field names in the Orders channel. In the main exp:chennel:entries loop, this exact same this ARE giving me the correct values... (so because they're is a SafeCracker form, something is going wrong).
    – JonkBok
    Jan 13, 2013 at 15:19
  • I just noticed that both select boxes are always set to the same value, namely the one of my {seller_trader} field, regardless of the order in which they are displayed.
    – JonkBok
    Jan 13, 2013 at 15:28

1 Answer 1


If you just want to pass the selected entry ID, try using the :child_ids tag instead:

{embed="orders/_order-buyer-dropdown" entry_id="{buyer_trader:child_ids}"}

Also to reduce the chance of a template parse error, you should update the conditional in your dropdown embed templates to use the normal EE conditional syntax:

<option value="{entry_id}" {if entry_id == embed:entry_id}selected{/if}>
  • Have you tried outputting {buyer-trader:child_ids} and {seller_trader:child_ids} side-by-side in the main template, to see if they’re returning the correct IDs? Jan 16, 2013 at 19:32
  • Hi Brandon, Thanks for you answer. Unfortunately this doesn't work. I've tried this before as this method was described on you Get Satisfaction support page. The strange thing is that if I put this variable {buyer_trader:child_ids} on the page so I can see the output (not inside the embed tag), I don't get anything. {buyer_trader}{title}{/buyer_trader} does however show the correct title. Whats wrong?
    – JonkBok
    Jan 16, 2013 at 19:38
  • I just checked again: if I place {buying_trader:child_ids} this on the page, it doesn't even pars the tag, it just prints the tag... (i changes the var name to see if that made a difference).
    – JonkBok
    Jan 16, 2013 at 20:09
  • Hmm, that’s odd. Are you running the latest versions of EE and Playa? Jan 16, 2013 at 21:00
  • Yes, I am. When I place the tag in the first template that is loaded via ajax on page load, it does parse correctly. But when its in my template that is loaded via ajax when a user clicks on a link, it's not being parsed (its not even in an embedded template, just one loaded via ajax in a safecracker form).
    – JonkBok
    Jan 16, 2013 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.