SQLFORM.factory(
    Field('EN','string',requires=IS_IN_DB(db, 'language.id', '%(EN)s', zero=
T('choose one')),
    Field('SP','string',requires=IS_IN_DB(db, 'language.id', '%(SP)s', zero=
T('choose one')),
    table_name="language_link")


(replace "language" by your won table name)

Then in your view:
<script type="text/javascript">
var idEN = "#language_link_EN";
var idSP = "#language_link_SP"
jQuery(idEN).change(function() {
    jQuery(idSP).val(jQuery(idEN).val());
});
jQuery(idSP).change(function() {
    jQuery(idEN).val(jQuery(idSP).val());
});
</script>



I did not try it but except syntax errors it should work...

Le mardi 22 mai 2012 21:14:27 UTC+2, max a écrit :
>
> I have a table with  two fields.
> EN  | SP
> Hello | Hola
> I | Yo
>
> Both the fields A and B represent the same vale in  two languages.
> I want in a drop-down field  , the  Spanish  value automatically selected, 
> when english value is set to a specific word.
> It  should also work , if I set the spanish word.
>
> Thankful for any ideas!
>
>
>
>
>
>
>
>
Le mardi 22 mai 2012 21:14:27 UTC+2, max a écrit :
>
> I have a table with  two fields.
> EN  | SP
> Hello | Hola
> I | Yo
>
> Both the fields A and B represent the same vale in  two languages.
> I want in a drop-down field  , the  Spanish  value automatically selected, 
> when english value is set to a specific word.
> It  should also work , if I set the spanish word.
>
> Thankful for any ideas!
>
>
>
>
>
>
>
>

Reply via email to