[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dolibarr-dev] extrafields label

From: Christophe Battarel
Subject: Re: [Dolibarr-dev] extrafields label
Date: Fri, 23 May 2014 14:39:59 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Finally , i have found a way to skirt the problem with some jquery and a hook; i give you the code below if you face the same problem :

    function formObjectOptions($parameters, $object, $action)

        // translate extrafields labels
        print '<script type="text/javascript">

            $(document).ready(function() {
                $("input[name^=options_").each(function() {
                    var labelCell = $(this).parent("td").prev("td");
                    // get the translation with an ajax call
$.get("'.dol_buildpath('/mymodule/',1).'ajax/translate.php", {text: $(labelCell).text(), langfile: "address@hidden"}, function(data) { $(labelCell).html(data); }, "html");

and here is the ajax translate.php program :


address@hidden("../../"); // For root directory if (! $res) address@hidden("../../../"); // For "custom" directory

$langfile = GETPOST('langfile');
$text = GETPOST('text');

print $langs->trans($text);

Le 23/05/2014 14:39, Philippe Grand a écrit :
Le 23/05/2014 14:35, Florian HENRY a écrit :
About that extrafield define and use by extranal module it can be nice to be able to define them into module descriptor rather than play with SQL request to create them, but it's another story.
I rather see what you mean ;-)
and agree one hundred times with you

reply via email to

[Prev in Thread] Current Thread [Next in Thread]