richselect options loading from database

edited July 2014 in Technical questions

Hello, here is my problem:
let's say I have a form titled "add new user". In this form, I have to specify which station the user is located in. I want to do it with a richselect field. The options for the richselect are in my database, in the table "stations" under the field "name".

So far I've come to a place where the richselect displays correct number of options (connects to the db) but doesnt know which field to use (it displays "undefined")
Can any1 help me?


  • Richselect allows detailed configuration of popup list
    Check the next snippet

    "options" here contain not only data but template configuration, that says how data will be shown as the options of the list.

  • Hi maksim
    Yes, I am aware of the template tag, but in this situation the data is loaded from DB
    the getCenters.php returns all centers - and I want the richselect to have their name
    can you help me with that?

    view: "richselect",
    name: "centerID",
    options: "<?= app::url('/center/api/getCenters') ?>",
    //template:"#name#" ???

  • Sorry, it seems I'm missing something.
    The data that you are are loading is an array of json objects, right ? So you can use template property to define how the data from options will be shown in popup list. The same template will be used to shot text in richselect itself

    The snipeet, which I have provide uses data parameter, but it can be changed to the url - to load data from the server, as in your case. Also, I the above snippet I have defined template not for the richselect itself, but to the popup list - thats important.

  • edited July 2014

    Thank you! You really helped!
    Greetings from Poland :)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion