I have a Matrix that contains a P&T Dropdown field. I'm trying to control the markup generated by the Matrix, so I am trying to follow breaking up a matrix field for use in safe cracker form.
Though the example has a <select> (I'm assuming it represents a P&T Dropdown), it doesn't show how to loop through its list of options. Is there a way to do this?

  • Did the answer provided work for you? – nonprofit_tech Dec 30 '12 at 1:33
  • No. I added some comments under Derek's response along with some additional information I found (albeit it being a year old). – ExpressionEngineNewbie Jan 1 '13 at 16:42
  • I think your solution here is to write a custom plugin that retrieves those options and returns them as variables. Probably more work than is reasonable to expect from an answer here (IMHO). If you're comfortable writing plugins, I could certainly leave an answer that describes the steps. – Derek Hogue Jan 2 '13 at 13:18

Have you tried using the {options:field_name} syntax, as demonstrated in the Safecracker docs?

<select name="my_field_name[row_new_0][col_id_14]">
                <option value="{option_value}">{option_name}</option>

I'm just not sure it will work with a third-party add-on like PT Select.

| improve this answer | |
  • I don't this works because the P&T list doesn't store the item options in the same db field as the native option. – Justin Kimbrell Dec 20 '12 at 16:22
  • The {options:field_name} syntax supplied by Derek should work fine for looping through the options - I'm using the exact same syntax for P&T Dropdown fields in SafeCracker forms. – Stephen Dec 28 '12 at 20:33
  • Thank for the correction, I will have to test it again. The last time I tried it didn't work for me, I may have done something wrong inadvertently. – Justin Kimbrell Dec 28 '12 at 22:01
  • @Derek - is {options:my_field_name} supposed to be the Matrix field name? Shouldn't I be looping through the Matrix' cell instead? Say I have a Matrix field name foo which contains a PT Dropdown cell named bar. Is it supposed to be {options:foo} or {options:bar} or something else? – ExpressionEngineNewbie Dec 31 '12 at 8:04
  • Just found this: getsatisfaction.com/pixelandtonic/topics/…. Brandon Kelly says there is no efficient way to do it. The post is over a year old, though. – ExpressionEngineNewbie Dec 31 '12 at 8:23

I've not used this in a SafeCracker form, but in a Low Search form, I've used the Low Options plugin to output the options from a P&T Dropdown field, so it might be worth a try if you're still having trouble with this.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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