field.types option override

field.types option override

gforstergforster Posts: 40Questions: 19Answers: 1

I have a field in Editor that is being populated by a mysql db. I'm using the leftJoin method to get to the table. I'm displaying it as a radio button. There are 8 options supplied from the DB, but I only wish to display a select 4 of them. However, doing this does override and all 8 are still displayed:

 {
     label: "My options:",
     name: "MYTABLE.foreignkey_id",
     type: "radio",
     options:[
         { label: "1", value: "1" },
         { label: "2", value: "2" },
         { label: "6", value: "6" },
         { label: "8", value: "8" }
     ]
}

Is there any way to display only a certain selection of all possible values in the database?

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    The Options class has a where method which can be used to limit the results. I presume that there is so logic to which values shouldn't be shown and a where condition could be applied for that? If not then there is the limit method which could be used instead.

    Allan

This discussion has been closed.