myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volker Weber" <>
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:

  function initOnEnter(textId, actionId) {
    var input = Tobago.element(textId);
    if input) {
      input.actionId = actionId;
      Tobago.addEventListener(input, "keyup", "submitOnEnter(" + textId + ")");

  function submitOnEnter(textId) {

<tc:in id="in_1" ...>
  <f:facet name="command">
    <tc:command id="cmd_1" .../>
</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.

Hope this helps


2007/6/14, Madan Narra <>:
> 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

View raw message