myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volker Weber" <v.we...@inexso.de>
Subject Re: [Tobago] Multiple defaultCommands in the same Tobago Page
Date Thu, 14 Jun 2007 13:02:05 GMT
Hi Madan,

it is not possible to have mor than one defaultCommand.

Can you use a 'change' facet?

I think we need a 'enter' (and 'escape' ...) facet.

Currently the only solution is to add a command facet and
add a eventlistener to the input by javascript to invoke the command
on keyup=13 event
like this:

<tc:script>
  function initOnEnter(textId, actionId) {
    var input = Tobago.element(textId);
    if input) {
      input.actionId = actionId;
      Tobago.addEventListener(input, "keyup", "submitOnEnter(" + textId + ")");
    }
  }

  function submitOnEnter(textId) {
    Tobago.submitAction(Tobago.element(textId).actionId);
  }
</tc:script>

<tc:in id="in_1" ...>
  <f:facet name="command">
    <tc:command id="cmd_1" .../>
  </f:facet>
</tc:in ...>
<tc:script onload="initOnEnter('page:in_1', 'page:cmd_1')"/>

note: this was just types from memory, but i have used something like
this before.
note2: tc:script (and tc:style) did not work on ajax requests e.g.
partial rendering.
          https://issues.apache.org/jira/browse/TOBAGO-332

Hope this helps

Regards,
    Volker



2007/6/14, Madan Narra <madan.tobago@gmail.com>:
> Hi All,
>
> I have created a template which has a SideNavigation Bar with a textfield
> and button, and the middle area has a textfield with a button next to it.
>
> I set defaultCommand="true" for both the buttons, but only one works at a
> time...
>
> is it possible to set defaultCommand="true" for both the buttons, and submit
> works to that button when the cursor focus  resides with its respecive
> textfield.. ?
>
> Can this be done... As i need this type of feature in my application
> --
> Regards,
> Madan N

Mime
View raw message