Select Widget properties

Archived from the Xataface Users forum.

jonbfl — Mon Oct 17, 2011 12:08 pm

OK, I.m going for broke to solve my two or three ‘Select’ issues -

First up - I’s like to return two values from a lookup.

I have a table of ISO country codes (pais) and the associated names (nombre)

I’d like to have the Select widget display both the ISO Country Code and the Country’s proper name.

I had used this code before to work with a relationship, but I can’t seem to get it turned around for this exercise
/tables/casos/ casos is the table that will store the value of pais_codigo from the table pais.
pais.php

Code: Select all
<?php /* I need to declare a class - its the table with the info */    class tables_pais {    function getTitle(&$record) {       return $record->val('codigo_pais');    }    function titleColumn(){       return "CONCAT(codigo_pais,' ',nombre_pais)";    } } ?>

valuelists.ini

Code: Select all
[pais] __sql__ = "SELECT id_pais, codigo_pais FROM pais ORDER BY id_pais" [regiones_departmentos]'

fields.ini

Code: Select all
[codigo_pais] widget:type = select vocabulary = pais

Is my problem that I have both a pais.php and a valuelists.ini entry ??? n Or do I just have the wrong returned value?