2 Replies Latest reply on Nov 16, 2009 7:30 AM by ilya_shaikovsky

    multiple rich:hotKey inside rich:tab's

    ahoehma

      I try to define multiple hotKeys inside rich:tab's but it doesn't work ...

      <rich:tabPanel switchType="ajax">
      
      <rich:tab label="Tab 1">
      <a4j:form>
      ...
      <a4j:commandButton id="save".../>
      <rich:hotKey key="return"
       handler="alert('tab 1 '+ ${rich:element('save')});return false;"/>
      </a4j:form>
      </rich:tab>
      
      <rich:tab label="Tab 2">
      <a4j:form>
      ...
      <a4j:commandButton id="save".../>
      <rich:hotKey key="return"
       handler="alert('tab 2 '+ ${rich:element('save')});return false;"/>
      </a4j:form>
      </rich:tab>
      
      <rich:tab label="Tab 3">
      <a4j:form>
      ...
      <a4j:commandButton id="save".../>
      <rich:hotKey key="return"
       handler="alert('tab 3 '+ ${rich:element('save')});return false;"/>
      </a4j:form>
      </rich:tab>
      
      </rich:tabPanel>
      


      Hit 'enter' in Tab 1 -> alertbox with "tab 1 [object HTMLInputElement]"
      Hit 'enter' in Tab 2 -> alertbox with "tab 2 null"
      Hit 'enter' in Tab 2 -> alertbox with "tab 3 null"

      If I change the order of the tabs to Tab 3, Tab 2, Tab 1 then:

      Hit 'enter' in Tab 3 -> alertbox with "tab 3 [object HTMLInputElement]"
      Hit 'enter' in Tab 2 -> alertbox with "tab 2 null"
      Hit 'enter' in Tab 1 -> alertbox with "tab 1 null"

      What's wrong here?

      Regards
      Andreas

        • 1. Re: multiple rich:hotKey inside rich:tab's
          ahoehma

          Its works if I change the keyhandler this way:

          <rich:tabPanel switchType="ajax">
          
          <rich:tab label="Tab 1">
          <a4j:form id="tabForm1">
          ...
          <a4j:commandButton id="save".../>
          <rich:hotKey key="return"
           handler="alert('tab 1 '+ ${rich:element('tabForm1:save')});return false;"/>
          </a4j:form>
          </rich:tab>
          
          <rich:tab label="Tab 2">
          <a4j:form id="tabForm2">
          ...
          <a4j:commandButton id="save".../>
          <rich:hotKey key="return"
           handler="alert('tab 2 '+ ${rich:element('tabForm2:save')});return false;"/>
          </a4j:form>
          </rich:tab>
          
          <rich:tab label="Tab 3">
          <a4j:form id="tabForm3">
          ...
          <a4j:commandButton id="save".../>
          <rich:hotKey key="return"
           handler="alert('tab 3 '+ ${rich:element('tabForm3:save')});return false;"/>
          </a4j:form>
          </rich:tab>
          
          </rich:tabPanel>
          
          


          Should i create a bug report ?

          • 2. Re: multiple rich:hotKey inside rich:tab's
            ilya_shaikovsky

            rich:element looks for "save" component in component tree and as your "save" buttons has all the same id's - it finds the first one always. but for sure it's wrong fir all the other ones. actually we could not know which concrete component you are interested in. So just gave them different id's or use full id's as you done in second snippet.