2016-08-26 11 views
0

エクスポート値ではなく、コンボボックスのテキストを選択するより良い方法はありますか?Acrobatコンボボックスは、エクスポートされた値ではなく選択されたアイテムを返します。

これまでに私が見つけたものがあります。

// combobox Return the export value 
var expValue = this.getField("Dropdown1").value; 

// combobox return the Selection by Indice 
var i = this.getField("ItemType1").currentValueIndices; 
console.println(this.getField("ItemType1").getItemAt(i,false)); 

これを行う簡単な方法を探してみてください。 これはイベントトリガコードではないため、 'change'プロパティと 'changeEX'プロパティは動作しません。

答えて

0

あなたの持っていることは、どのように行われたかです。文書レベルの関数を作成して、それを少し簡単にすることができます。

0

ご回答いただきありがとうございます これ以上の選択を返さなければならない場合は、このためにドキュメントレベル機能を作成しました。だから私はそれが行われると信じています。

function ReturnSelection(fieldName){ 
    // Check that Field is ComboBox or List Box 
    var fldField = this.getField(fieldName); 

    if(fldField != null && (fldField.type === "combobox" || fldField.type === "listbox")){ 
     // combobox return the Selection by Indice 
     var i = fldField.currentValueIndices; 
     return fldField.getItemAt(i,false); 

    }else{ 
     return ""; 
    } 
} 

テストされていません。

と返すようにマルチ選択

よさそうだ
function ReturnSelection(fieldName){ 
    // Check that Field is ComboBox or List Box 
    var fldField = this.getField(fieldName); 
    if(fldField != null && (fldField.type === "combobox" || fldField.type === "listbox")){ 
     // combobox return the Selection by Indice 
     var i = fldField.currentValueIndices; 
     if(typeof i == "number"){ 
      return fldField.getItemAt(i,false); 
     }else{ // Deal With Multi Selections 
      var arr = []; 
      for(var a = 0; a < i.lenght){ 
       arr.push(fldField.getItemAt(i[a],false)); 
      } 
      return arr; 
     } 
    }else{ // Not a Combo or list box 
     return ""; 
    } 
} 
0

。私はnullを返すgetFieldメソッドの場合を処理することをお勧めします。これは存在しないフィールドや他の特定の状況でフィールドを指定した場合に発生します。