myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Helmut Swaczinna" <>
Subject Re: [Tobago] Using tc:command with client side JavaScript
Date Wed, 13 Jun 2007 13:52:08 GMT
Hi Dieter,

the onclick attribue of tc:command does not work (is not implemented). I tried the same thing
as you before.


Maybe it will be implemented if there's more than one request for it.

As a workaround you can do the disabling on the server with ajax. Use the renderedpartially
attribute of
tc:command and reload the input fields every time the checkbox is clicked.


  ----- Original Message ----- 
  From: Melnizky Dieter 
  Sent: Wednesday, June 13, 2007 3:40 PM
  Subject: [Tobago] Using tc:command with client side JavaScript

  I want to toggle the disabled attribute of input fields, depending on the selected value
of a tc:selectBooleanCheckbox.
  The idea is to add a JavaScript function that enables the fields, which should be called
when the selectBooleanCheckbox is clicked.
  Since the onchange-Attribute is not supported, I tried to use a change facet with a tc:command,
setting the onclick attribute to the function I wrote:


  function immediateChanged() {
   var immediate = Tobago.element("page:ft_download_parameter:immediateCheckBox").checked
== true;
   // change fields here ...

  <tc:selectBooleanCheckbox value="#{getData.immediate}" id="immediateCheckBox" label="#{nbmBundle.ft_labelImmediate}"
   <f:facet name="change">
    <tc:command immediate="false" onclick="immediateChanged();"></tc:command>

  This is generated, my immediateChanged() function is ignored (the complete page is submitted
to the server):

  var element = Tobago.element("page:ft_download_parameter:immediateCheckBox");
  if (element) {
  Tobago.addEventListener(element, "change", function(){Tobago.submitAction('page:ft_download_parameter:_idJsp92')});

  Does anyone have an idea how I can call my client side JavaScript function, when the user
has clicked the checkbox?

  Best regards,
  The information contained in this e-mail message is privileged and
  confidential and is for the exclusive use of the addressee. The person
  who receives this message and who is not the addressee, one of his
  employees or an agent entitled to hand it over to the addressee, is
  informed that he may not use, disclose or reproduce the contents thereof.

View raw message