2017-08-11 5 views
0

投稿者が指定した値から選択した値をフェッチする方法を教えてください。タッチUIダイアログ javascriptを使用してさらに操作できます。以下は投稿者[AEM]がJavascriptで選択したダイアログプロパティ値を取得する

は、私は私のJavaScriptで./allowed(ドロップダウン)のダイアログプロパティ値を取得したいと思い、私のダイアログ構造ここで

<?xml version="1.0" encoding="UTF-8"?> 
 
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" 
 
    jcr:primaryType="nt:unstructured" 
 
    sling:resourceType="cq/gui/components/authoring/dialog"> 
 
    <content 
 
     jcr:primaryType="nt:unstructured" 
 
     sling:resourceType="granite/ui/components/foundation/container"> 
 
     <layout 
 
      jcr:primaryType="nt:unstructured" 
 
      sling:resourceType="granite/ui/components/foundation/layouts/tabs" 
 
      type="nav"/> 
 
     <items jcr:primaryType="nt:unstructured"> 
 
      <General 
 
       jcr:primaryType="nt:unstructured" 
 
       jcr:title="General Questions" 
 
       sling:resourceType="granite/ui/components/foundation/container"> 
 
       <layout 
 
        jcr:primaryType="nt:unstructured" 
 
        sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/> 
 
       <items jcr:primaryType="nt:unstructured"> 
 
        <columns 
 
         jcr:primaryType="nt:unstructured" 
 
         sling:resourceType="granite/ui/components/foundation/container"> 
 
         <items jcr:primaryType="nt:unstructured"> 
 
          <allowed-selections 
 
           jcr:primaryType="nt:unstructured" 
 
           sling:resourceType="granite/ui/components/foundation/form/select" 
 
           fieldLabel="Allowed Selections" 
 
           name="./allowed"> 
 
           <items jcr:primaryType="nt:unstructured"> 
 
            <one 
 
             jcr:primaryType="nt:unstructured" 
 
             text="One" 
 
             value="one"/> 
 
            <two 
 
             jcr:primaryType="nt:unstructured" 
 
             text="Two" 
 
             value="two"/> 
 
            <three 
 
             jcr:primaryType="nt:unstructured" 
 
             text="Three" 
 
             value="three"/> 
 
            <four 
 
             jcr:primaryType="nt:unstructured" 
 
             text="Four" 
 
             value="four"/> 
 
           </items> 
 
          </allowed-selections> 
 
          <description/> 
 
          <selection-text 
 
           jcr:primaryType="nt:unstructured" 
 
           sling:resourceType="granite/ui/components/foundation/form/textfield"        
 
           fieldLabel="Selection Text" 
 
           name="./selectiontext"/> 
 
         </items> 
 
        </columns> 
 
       </items> 
 
      </General> 
 
     </items> 
 
    </content> 
 
</jcr:root>

です。

ありがとうございます。

答えて

0

AEMは、あなたが私たちは、以下のファイル

/libsに/ CQ/GUI /コンポーネント/オーサリング/ダイアログ/ dropdownshowhide/clientlibsを持って etcフォルダを参照してくださいfeature.If表示/非表示を実装するために1つのOOTBライブラリを持っています/dropdownshowhide/js/dropdownshowhide.js

Foundationcontentloaded、変更および選択されたイベントを見る

を取得されたクラス名セレクタとターゲット要素の選択値に基づいて、そこに捕捉されるサンプルスニペット

$(document).on("selected", ".dropdownselect", function(e) { 
    //iterate over e and get element select value 
}); 

$(要素)。データ(「選択」)。getValue();

そのは、JSの上に与えられたとして、あなたが選択したリスナーを使用して選択し、ドロップダウン値を取得し、あなたのダイアログクラスの追加dropdownselectでは、カスタム・ロジックに

を行うことができますクラス、dataattributeとセレクタを追加するとすることができます変更イベントの値を取得する

<allowed-selections 
jcr:primaryType="nt:unstructured"sl 
sling:resourceType="granite/ui/components/foundation/form/select" 
fieldLabel="Allowed Selections" 
name="./allowed" 
class = "dropdownselect"> 
+1

今後他の人に絶対パスが役立つとは思えません。ソリューションを少し拡張して一般的な方法で理解できるようにする必要があります。 – jdv

+0

私はこのファイルがある場所のデフォルトの場所を指していました。私はいくつかの入力で解決策を更新していきます。 – sherry

+0

道に迷っている人がこのファイルをこの場所に持っていないことを保証します。この場所は一部のプラットフォームではデフォルトにすぎません。次を参照してください:https://stackoverflow.com/help/how-to-answer – jdv

関連する問題