Changeset 40983 in spip-zone for _plugins_/forms


Ignore:
Timestamp:
Sep 22, 2010, 12:13:15 PM (11 years ago)
Author:
renato@…
Message:

enable translations for textareas too

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/forms/forms_et_tables_2_0/forms_lang.js

    r37653 r40983  
    55$.extend(forms_css_cur_link,forms_css_link);
    66$.extend(forms_css_cur_link,{fontWeight:"bold"});
     7var forms_fields_selector = 'input[id^=nom],textarea[id^=nom]';
    78
    89function forms_init_lang() {
     
    4041        //store the fields inputs for later use (usefull for select)
    4142        var target_name = target!=forms_forms?target[0].nom_champ.id:"undefined";
    42         if(!forms_fields[target_name]) forms_fields[target_name] = $('input[id^="nom_"]',target);
     43        if(!forms_fields[target_name]) forms_fields[target_name] = $(forms_fields_selector,target);
    4344        //save the current values
    4445        forms_fields[target_name].each(function(){
     
    5657        if(target) forms_forms.add($("div.forms_champs form",target).get());
    5758        forms_fields = {};
    58         forms_fields["undefined"] = $('input[id^="nom_"]',forms_forms);
     59        forms_fields["undefined"] = $(forms_fields_selector,forms_forms);
    5960        //store the fields of the target if any
    6061        var init_forms = target?$("div.forms_champs form",target):forms_forms;
    6162        //init the value of the field to current lang
    6263        init_forms.each(function() { this.form_lang = forms_def_lang; });
    63         $('input[id^="nom_"]',init_forms).each(function(){
     64        $(forms_fields_selector,init_forms).each(function(){
    6465                forms_init_field(this,this.form.form_lang);
    6566        });
     
    128129        forms_containers.not($(this).prev());
    129130        //build the input values
    130         $('input[id^="nom_"]',this).each(function(){
     131        $(forms_fields_selector,this).each(function(){
    131132                //save data before submit
    132133                forms_save_lang(this,form.form_lang || forms_def_lang);
Note: See TracChangeset for help on using the changeset viewer.